CSS filter Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The filter property applies graphical effects such as blur, brightness, contrast, grayscale, and drop-shadow to an element’s rendered result — including its contents, borders, and backgrounds.

Use one or more filter functions, or an SVG filter via url(). Filters run in the order you list them. The property is not inherited.

Baseline · Widely available.

Not deprecated. Core filter functions are widely supported. SVG url() filters can vary by browser.

CSS Syntax

syntax.css
filter: none | <filter-function>+ | url(...);

Example: filter: grayscale(80%) blur(2px);. Invalid function arguments make the whole value act like none.

Property Values

ValueDescriptionTry it
noneNo filter. Initial valueTry it
blur()Gaussian blur. Length such as 4pxTry it
brightness()Brighten or darken. 100% / 1 is unchangedTry it
contrast()Adjust contrast. Values over 100% increase itTry it
grayscale()Desaturate toward gray. 100% is fully grayTry it
sepia() / hue-rotate()Warm sepia tone, or rotate hues by an angleTry it
drop-shadow()Shadow that follows the alpha shape (not a box shadow)Try it
Multiple / url()Chain functions in order, or reference an SVG filterTry it

Also available: invert(), opacity(), and saturate(). Percent and number forms often both work (for example 0.5 = 50%).

How to Use filter

Pick an effect, apply it to the element, then chain more only if you need them.

  1. Choose the target (image, card, icon, or any element).
  2. Start with one function, such as blur(4px) or grayscale(100%).
  3. Chain more functions with spaces when you need a combined look.
  4. Prefer backdrop-filter when you want to blur what is behind a translucent panel.
PieceRequired?Role
Filter function or url()Yes (or none)Defines the visual effect
OrderMatters when chainedFunctions run left to right
InheritedNoSet on each filtered element
Valid argumentsYesOne invalid function can cancel the whole list

Live Preview

Change filter and watch the sample box update.

The sample includes a bright border so you can see that filters affect the whole painted result.

Sample

filter: none

CSS Examples

Each snippet focuses on filter. Use Try It Yourself for a live editor.

Example 1 — Blur

Soften an element with a Gaussian blur.

CSS
<style>
  .soft {
    filter: blur(4px);
  }
</style>

<div class="soft">Blurred</div>
Try It Yourself

How It Works

  1. Target the element. The rule applies to .soft.
  2. Set blur(4px). Larger lengths blur more.
  3. Whole layer blurs. Text, background, and border all soften together.
  4. Try 0 in the editor to clear the blur.

Example 2 — Grayscale

Desaturate colors toward gray.

CSS
<style>
  .muted {
    filter: grayscale(100%);
  }
</style>

<div class="muted">Gray</div>
Try It Yourself

How It Works

  1. Set grayscale(100%). Full desaturation.
  2. Partial values work. 50% keeps some color.
  3. Useful for muted UI such as inactive cards or hover reveals.
  4. Do not rely on color alone to convey meaning for accessibility.

Example 3 — Chain Filters

Combine functions; order matters.

CSS
<style>
  .look {
    filter: contrast(120%) saturate(140%);
  }
</style>

<div class="look">Chained</div>
Try It Yourself

How It Works

  1. List functions with spaces. No commas between them.
  2. Order is left to right. Contrast runs, then saturate.
  3. Swap the order in the editor to see a different result.
  4. Keep chains short for clearer code and better performance.

Edge Cases & Pitfalls

If a filter looks wrong or disappears, check these first.

vs

filter vs backdrop-filter

filter changes the element itself. backdrop-filter changes only what shows through it (frosted glass).

invalid

One bad argument cancels the list

If any function has an invalid parameter, the property computes to none. Check units (px, deg, %).

shadow

drop-shadow is not box-shadow

drop-shadow() follows the alpha outline. It has no inset or spread like box-shadow.

perf

Heavy filters cost performance

Large blurs on big layers can be expensive. Prefer smaller radii and avoid animating huge filtered areas when possible.

a11y

Do not convey meaning by color alone

Grayscale or hue shifts are visual only. Pair status with text or icons so color-blind users still understand.

Browser Support

filter is a browser CSS property for visual effects. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

filter

Core filter functions work in all modern browsers. SVG url() filters may differ by engine.

96% Core function support
Google Chrome All modern versions
Full support
Mozilla Firefox All modern versions
Full support
Apple Safari All modern versions
Full support
Microsoft Edge All modern versions
Full support
Opera All modern versions
Full support
Samsung Internet Supported
Full support
Internet Explorer No standard filter
No support
filter Widely supported

Bottom line: Safe for everyday blur, grayscale, and color filters. Verify SVG url() filters on target browsers. It is not a runtime API.

Key Takeaways

  • Role: apply visual effects to an element’s painted result.
  • Initial: none. Not inherited.
  • Chain with spaces. Order matters.
  • Behind the glass? Use backdrop-filter instead.

One line: filter restyles how the element looks — blur, color, shadow — without changing layout.

Frequently Asked Questions

It applies graphical effects such as blur, brightness, contrast, grayscale, and drop-shadow to an element’s rendered result, including its contents, borders, and backgrounds.
The initial value is none. No filter effects are applied.
Yes. List functions separated by spaces. They run in order, for example filter: contrast(120%) brightness(110%);.
filter affects the element and everything painted inside it. backdrop-filter affects only what shows through the element, such as a frosted overlay.
No. Set it on each element that should be filtered. Children are included visually because the whole layer is filtered together.
It is Baseline Widely available. SVG url() filters can vary by browser. It is a browser CSS property, not a Node.js feature.

Next: flex

Grow, shrink, and set the basis of flex items.

flex tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful