Skip to main content
CalcChef

CSS Filter Generator

Combine blur, brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia and drop-shadow on a preview; copy CSS, Tailwind or an SVG filter. How it works

Use the CSS Filter Generator

Preview
filter: none;

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

About the CSS Filter Generator

The CSS filter property takes ten functions, blur, brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia and drop-shadow, and applies them in the order they are written (W3C Filter Effects Module Level 1). The CSS Filter Generator writes them in that order and leaves out any at its starting value, so the Vintage preset is filter: brightness(90%) contrast(110%) sepia(40%);.

The filter functions, their range here and the SVG export

FunctionRange in this toolStarting valueSVG primitive
blur0 to 20 px0pxfeGaussianBlur
brightness0 to 200%100%feComponentTransfer
contrast0 to 200%100%feComponentTransfer
grayscale0 to 100%0%feColorMatrix
hue-rotate0 to 360deg0degfeColorMatrix
invert0 to 100%0%feColorMatrix
opacity0 to 100%100%feComponentTransfer
saturate0 to 200%100%feColorMatrix
sepia0 to 100%0%feColorMatrix

drop-shadow takes an X and Y offset of -50 to 50 px, a blur of 0 to 50 px and a color, starts at 4px 4px 8px #000000 and becomes feDropShadow.

The presets as CSS and Tailwind

PresetfilterTailwind classes
Grayscalegrayscale(100%)grayscale-[100%]
Vintagebrightness(90%) contrast(110%) sepia(40%)brightness-[90%] contrast-[110%] sepia-[40%]
High Contrastcontrast(200%) saturate(150%)contrast-[200%] saturate-[150%]
Night Visionbrightness(60%) hue-rotate(90deg) saturate(200%)brightness-[60%] hue-rotate-[90deg] saturate-[200%]
X-Raygrayscale(100%) invert(100%)grayscale-[100%] invert-[100%]

This is the output with Leave out unchanged filters on, which is the default; with it off, each line lists all nine functions. Choosing a preset also switches the drop shadow off.

Frequently asked questions

Does the order of CSS filter functions matter?
Yes. The W3C Filter Effects spec says the functions in a filter list are applied in the order provided, each to the result of the one before. This tool always writes one order, blur first and drop-shadow last, so the shadow is cast by the image after the other filters: with opacity(50%) earlier in the list the shadow is fainter too. For another order, edit the copied value.
How do I animate between two filters with a CSS transition?
Turn off Leave out unchanged filters so every output lists all nine functions in the same order. Under section 14.1 of the Filter Effects spec two lists are interpolated function by function, and a shorter list is padded at its end with the missing functions at their starting values, so lists with different functions in the same place do not line up; writing all nine avoids that.
How do I use the SVG filter export?
Paste the SVG into your HTML and set filter: url(#user-filter); on the element. The filter carries color-interpolation-filters set to sRGB, because CSS filter functions work in sRGB while SVG filter primitives default to linearRGB (sections 5 and 9.1 of the spec); without it the SVG version would not match the preview.
Why is opacity a separate class in the Tailwind output?
Tailwind's filter utilities are blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, saturate and sepia, with none for the opacity() function, so the output uses opacity-[50%], which sets the element's opacity property. It fades the element too, but it is a separate property from filter.
What happens if I type 250 for brightness?
The box keeps what you typed and shows Brightness must be from 0 to 200. The filter keeps its last valid value. A cleared box asks for a number and does not write 0. Nothing is clamped without a message.
Can I use my own image?
Type the address of an image on the web and the preview loads it from the site that hosts it; there is no file upload. The starting sample comes from picsum.photos. If your address fails, the page says so and shows the sample.

Network use

This tool loads a sample image from picsum.photos by default, and any image URL you type is requested from its host. Privacy policy

Related Tools

View all tools