CSSApr 5, 2026 ยท Updated Oct 13, 2026 ยท 3 min read

How to Use CSS Filter Effects (Blur, Grayscale, Sepia & More)

CSS filter functions with three behaviors measured in Chromium: their order changes the colors, contrast pivots on mid-grey, and any filter, even blur(0), traps position: fixed children inside the filtered element.

๐Ÿ”ฌ
Try the CSS Filter Playground
Free, no signup
โ†’
DG
Derek Giordano
Designer & Developer
In this guide
01The Filter Functions02Three Behaviors, Measured in Chromium03Hover Effects and Performance

The Filter Functions

filter takes a list of functions: blur(), brightness(), contrast(), grayscale(), sepia(), saturate(), hue-rotate(), invert(), opacity() and drop-shadow(), plus url() for an SVG filter. Percentages and plain numbers are interchangeable (grayscale(100%) = grayscale(1)). They work on any element, not only images, and do not change the source file.

Three Behaviors, Measured in Chromium

We rendered small colored squares and read the pixels back (October 14, 2026; script in our test folder).

1. Order changes the result

Colorsepia(1) grayscale(1)grayscale(1) sepia(1)
#3b82f6#999999#a79474
#ff3366#8f8f8f#84765c

Each function feeds the next, so grayscale last gives grey and sepia last gives brown. The same holds for saturate() and hue-rotate(): on #ff3366 the two orders gave #6a4800 and #667b00.

2. Contrast pivots on the middle

contrast(1.5) left mid-grey #808080 unchanged, while brightness(1.5) took it to #c0c0c0 and brightness(0.5) to #404040: contrast stretches values away from 50%, brightness multiplies them. invert(1) turned #808080 into #7f7f7f, so a mid-grey "inverted" looks the same.

3. A filter traps fixed-position children

A position: fixed box normally sticks to the viewport. Inside a parent with any filter, even filter: blur(0), it was positioned relative to the parent instead: 500px down the page rather than at the top. The Filter Effects spec makes a filtered element the containing block for fixed and absolute descendants and gives it its own stacking context. A filter on body or a page wrapper (for a dark-mode or blur effect) therefore breaks sticky headers, modals and tooltips inside it. Apply the filter to a sibling or a pseudo-element instead.

Hover Effects and Performance

Grayscale-to-color and slight brightness lifts are the common hover effects:

img { filter: grayscale(1); transition: filter 0.3s; }
img:hover { filter: none; }

Filters force the browser to render the element into its own layer and repaint it when the value changes. One image on hover is cheap; animating a blur on many large elements, or on a full-page wrapper, is not. Use drop-shadow() instead of box-shadow when the element has transparent areas (a PNG icon, a clipped shape), because it follows the visible pixels rather than the box.

For blurring what is behind an element (frosted glass) the property is backdrop-filter, covered with measurements in our glassmorphism guide. The CSS Filter Playground adjusts every function with sliders on sample photos and copies the CSS in the order you set them.

Frequently Asked Questions

What CSS filters are available?+
blur, brightness, contrast, grayscale, sepia, hue-rotate, saturate, invert, opacity, and drop-shadow. They can be chained in a single filter declaration and animated with transitions.
Can I animate CSS filters?+
Yes. Use transition: filter 0.3s ease and change filter values on hover or other states. Filters are GPU-accelerated, so animations are generally smooth.
What is the difference between filter and backdrop-filter?+
filter applies effects to the element itself and its contents. backdrop-filter applies effects to the area behind the element, creating glass and blur overlay effects.
Try it yourself

Use the CSS Filter Playground โ€” free, no signup required.

โšก Open CSS Filter Playground
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.