UseToolSuite UseToolSuite

CSS Filter Generator

Combine CSS filter effects visually with live preview. Adjust blur, brightness, contrast, grayscale, hue-rotate, saturate, and sepia with 12 presets.

0px
100%
100%
0%
0deg
0%
100%
100%
0%

The ten filter functions

filter applies graphical effects to an element and all its children, chaining space-separated functions:

FunctionDoes
blur(px)Gaussian blur
brightness(%)Lighten/darken (100% = normal)
contrast(%)Tonal range
grayscale(%)Desaturate to gray
saturate(%)Color intensity
hue-rotate(deg)Shift colors on the wheel
invert(%)Invert colors
sepia(%)Warm brown tone
opacity(%)Transparency
drop-shadow()Shadow following the alpha shape

Most are cheap color-matrix operations that run per-pixel on the GPU; blur() is the expensive one because it samples neighboring pixels, so large blur radii on big elements can drop frames.

filter vs backdrop-filter

A crucial distinction: filter affects the element and its content, while backdrop-filter affects the area behind the element. Want a frosted-glass panel where the background blurs but the panel’s text stays sharp? That’s backdrop-filter: blur(10px), not filter. Use filter for image and content effects; backdrop-filter for glassmorphism overlays and modal scrims. (The Glassmorphism Generator is built around backdrop-filter.)

Side effects to plan around

Two behaviors catch people out:

  • It affects all children — there’s no way to exclude a child from a parent’s filter. To filter only a background, apply the filter to a ::before/::after pseudo-element behind the content, or use backdrop-filter on an overlay.
  • It creates a stacking/containing context — which breaks position: fixed descendants (see FAQ) and can change z-index behavior. Keep fixed/sticky elements out of filtered ancestors.

A handy recipe

A quick approximate dark-mode for images: filter: invert(1) hue-rotate(180deg) inverts light/dark while rotating the hue back so colors stay roughly correct. Filters are non-destructive and reversible (they don’t touch the source file), GPU-accelerated, and free of server processing — tune blur, brightness, contrast, and the rest with the live preview, mindful that function order changes the outcome.

Last updated Built and maintained by Necmeddin Cunedioglu How tools are tested

How helpful was this tool?

Click to rate

Key Concepts

Gaussian Blur

A blur algorithm that uses a Gaussian (bell curve) distribution to average pixel values with their neighbors. The blur() CSS function parameter specifies the standard deviation of the Gaussian function in pixels — larger values produce more blurring. A 0px blur has no effect. The visible extent of the blur extends approximately 2-3× beyond the specified radius.

Color Matrix

A mathematical transformation applied to the RGBA color values of each pixel. CSS filter functions like brightness, contrast, grayscale, saturate, and sepia are all implemented as color matrix operations. A 5×4 matrix multiplied by the [R, G, B, A, 1] vector produces the filtered color. These operations are extremely fast because they process each pixel independently.

Stacking Context

A three-dimensional conceptualization of HTML elements along the z-axis. Certain CSS properties (including filter, opacity, transform, and position with z-index) create new stacking contexts. Elements within a stacking context are painted together as a unit, and their z-index values are resolved relative to the stacking context, not the document root.

Frequently Asked Questions

What CSS filter functions are available?

CSS supports 10 filter functions: blur() adds Gaussian blur in pixels, brightness() adjusts lightness (100% = normal), contrast() adjusts tonal range, grayscale() converts to gray (100% = full gray), hue-rotate() shifts colors on the color wheel in degrees, invert() inverts colors (100% = full inversion), opacity() adjusts transparency, saturate() adjusts color intensity, sepia() applies a warm brown tone, and drop-shadow() adds a shadow following the element's alpha shape. This tool covers the first 9.

What is the difference between CSS filter and backdrop-filter?

filter applies effects to the element itself and all its children — the element's own content is filtered. backdrop-filter applies effects to the area behind the element — creating frosted glass effects where the background is blurred but the element's content remains sharp. Use filter for image effects; use backdrop-filter for glass morphism UI overlays and modal backgrounds.

Can I combine multiple filter functions?

Yes. CSS filter accepts a space-separated list of filter functions that are applied in order from left to right. filter: grayscale(100%) contrast(150%) first converts to grayscale then increases contrast. The order matters — different orders produce different results because each function operates on the output of the previous one.

Are CSS filters performant for production use?

CSS filters are GPU-accelerated in all modern browsers and generally performant. However, blur() is the most expensive filter function because it requires sampling neighboring pixels — large blur radii on large elements can cause frame drops. Brightness, contrast, grayscale, saturate, and sepia are simple color matrix operations and are very fast. For animated filters, prefer opacity and avoid animating large blur values.

Can I use CSS filters to create dark mode images?

Yes. A common technique is filter: invert(1) hue-rotate(180deg) to invert all colors and then rotate the hue back by 180°. This approximates dark mode for images by swapping light and dark areas while preserving the original color relationships. For photos, filter: brightness(0.8) contrast(1.1) can reduce harshness on dark backgrounds. Fine-tune with this tool to find the right balance for your images.

How do CSS filter presets compare to image editor filters?

CSS filters are applied at render time and do not modify the original image file — they are non-destructive and reversible. Unlike Photoshop or Lightroom presets, CSS filters are limited to the 10 available functions and cannot perform complex operations like selective color adjustment, curves, or channel mixing. However, for common web effects (grayscale, sepia, blur, brightness/contrast), CSS filters produce results equivalent to image editor operations at zero server processing cost.

Why does position: fixed break inside an element with a filter?

Any non-none filter value makes the element a 'containing block' for its descendants and creates a new stacking context — and that changes what position: fixed is fixed RELATIVE TO. Normally fixed positioning anchors to the viewport, but inside a filtered ancestor, a fixed child anchors to the FILTERED element instead, so it no longer sticks to the screen as you scroll. This trips people up constantly with modals, sticky headers, and dropdowns placed inside a parent that happens to have a filter (or transform, which does the same thing). It's a spec requirement, not a bug. The fix is structural: move the fixed element OUT of the filtered ancestor in the DOM, or apply the filter to a different element that doesn't wrap your fixed content.

Does the order of filter functions matter?

Yes — filters are applied left to right, each operating on the output of the previous one, so reordering them changes the result. filter: grayscale(100%) contrast(150%) first strips color, THEN boosts the contrast of the resulting grays; filter: contrast(150%) grayscale(100%) boosts contrast on the colored image first, then desaturates, producing a different tonal result. The same is true for hue-rotate before vs after saturate, or blur before vs after brightness. When an effect doesn't look how you expect, try swapping the function order. This is also why building a 'look' is iterative — small reorderings of the same functions give meaningfully different outputs, which the live preview here lets you explore quickly.

Troubleshooting & Technical Tips

Filter applied to parent affecting all child elements

CSS filter applies to the entire element and all of its descendants — there is no way to exclude child elements from the parent's filter. If you need to filter only the background, use a pseudo-element (::before or ::after) with the filter applied to it, positioned behind the content. Alternatively, use backdrop-filter on an overlay element for frosted glass effects that do not affect the content.

filter: blur() creating visible edges around the element

Gaussian blur extends beyond the element's boundaries by approximately the blur radius. If the element has a defined boundary (container with overflow: hidden), the blur is clipped at the edges, creating a sharp visible border. Solution: increase the element's size by the blur radius on all sides (negative margin and corresponding positive padding), or remove overflow: hidden from the parent container.

CSS filter creating new stacking context: z-index issues

Any non-none filter value creates a new stacking context on the element. This means child elements with z-index can no longer interact with elements outside the filtered parent's stacking context. Position: fixed elements inside a filtered parent will be positioned relative to the filtered element instead of the viewport. This is a specification requirement, not a bug — restructure your HTML hierarchy if this causes layout issues.

Related Tools

Embed this tool on your site

Paste this snippet into any HTML page or blog post to embed a live, fully working copy of CSS Filter Generator. Free for any use.