CSS Filter Generator

Set the amount for each filter function and get a single filter line to paste onto an image, a video or any other element. Only the values you change are written, in the same order every time, so the code stays short. This page does not show your picture, so the guide describes what each function does to an image and where the values usually sit for common looks.

What you enter

  • Blur
  • Brightness
  • Contrast
  • Grayscale
  • Sepia
  • Saturate
  • Hue rotate
  • Invert
  • Opacity
  • Add a drop shadow
  • Shadow offset across
  • Shadow offset down
  • Shadow blur
  • Shadow colour
  • Write

How it works

  1. Leave every slider at its starting value to change nothing. The starting values are blur 0, brightness 100%, contrast 100%, grayscale 0, sepia 0, saturate 100%, hue 0, invert 0 and opacity 100%.
  2. Change the ones you want. Tick Drop shadow if you want a shadow that follows the shape of a transparent PNG or SVG.
  3. Choose whether to write the filter property, the backdrop-filter property used for frosted glass, or both.
  4. Copy the line and paste it into the CSS rule for your image or element, then adjust the numbers once you see the result on your page.

What each function does to a picture

Brightness multiplies every colour value, so 50% is a darker copy and 150% is a lighter one, clipping to white. Contrast pushes values away from mid grey when it is above 100% and pulls them toward grey when below. Saturate scales the strength of colour: zero is grey, and values above 100% make colours more vivid.

Grayscale and sepia blend the picture toward a grey or a brown tone by the given amount. Invert flips the colours like a photographic negative. Hue-rotate spins every colour around the colour wheel by the angle, which is a quick way to recolour an illustration, and 180 degrees swaps each colour for its opposite.

Using filters well in a design

Filters let you restyle one image in several ways without making new files. A row of client logos can be shown in grayscale at 60% opacity and bloom to full colour on hover, which keeps a busy page calm. A hero photo can be darkened with brightness so white text stays readable on top.

Be careful with filters on text and thin lines, because blur and other effects soften the edges. Also check what happens with print and high contrast modes, where your colour choices may be overridden. Do not use a filter as the only way to show a state such as selected or disabled.

Tips

  • For a faded, matte photo, try contrast 90% with brightness 110% and saturate 85%. For a punchy one, raise contrast to 115% and saturate to 120%.
  • Grayscale 100% with a small blur and brightness 70% makes a good dimmed image to put text over.
  • The order matters. Filters are applied one after another, so grayscale followed by sepia is not the same as sepia followed by grayscale. This tool writes them in a fixed, sensible order.
  • A hover effect is easy: set the filter on the normal state, a different one on :hover and add a transition on filter.
  • Backdrop-filter blurs what is behind an element, so it needs a semi-transparent background on the element to be seen.

Frequently asked questions

What is a CSS filter?

A CSS filter applies a visual effect to an element and everything inside it when the browser draws it. The original image file is not changed. You can chain several functions in one filter property, separated by spaces.

What do the values mean?

Brightness, contrast, saturate, grayscale, sepia, invert and opacity are percentages where 100% means no change for brightness, contrast, saturate and opacity, and 0% means no change for grayscale, sepia and invert. Blur is a radius in pixels, and hue-rotate is an angle in degrees around the colour wheel.

What is the difference between filter and backdrop-filter?

Filter changes the element itself. Backdrop-filter changes whatever is behind the element, which is how frosted glass panels are made. Choose both to write the same functions for each property.

Why is the drop shadow a filter and not box-shadow?

Box-shadow follows the rectangular box. The drop-shadow function follows the visible shape of the image, so a logo with a transparent background gets a shadow around the logo itself and not around its empty corners.

Do filters slow the page down?

A single static filter is cheap. Large blurs on big areas, or on elements that animate or scroll, make the browser do much more work, so keep blur radii small and avoid stacking many filtered layers on a phone.

Related: CSS shadow generator, Image compressor, Colour palette from image.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Free Tools

Product

Who It's For

Features

Resources

Company

View Sitemap