CSS filter Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Visual Effects

What You’ll Learn

The filter property lets you apply visual effects like blur, grayscale, brightness, and contrast to any element — most often images — without editing the original file.

01

Visual effects

Blur and color shifts.

02

Syntax

Filter functions.

03

Chain filters

Combine multiple.

04

Default none

No effect applied.

05

Images & UI

Photos, icons, cards.

06

drop-shadow

Shape-aware shadow.

Introduction

The filter property in CSS provides a way to apply graphical effects like blur, grayscale, brightness, and contrast to elements. This property is useful for adding visual effects without needing to modify the original image or content. It can be applied to any HTML element but is most commonly used with images and other graphical elements.

Definition and Usage

Apply filter directly on the element you want to transform. The effect is rendered on the element and everything inside it as a single visual layer. Use it for hover states, disabled thumbnails, photo treatments, and decorative UI accents.

💡
Beginner Tip

Need a frosted-glass overlay that blurs content behind a panel? Use backdrop-filter instead. Use filter when you want to change the element itself.

📝 Syntax

The syntax for the filter property is as follows:

syntax.css
element {
  filter: filter-function(value);
}

You can apply multiple filters by separating them with spaces:

syntax-chained.css
element {
  filter: filter-function1(value1) filter-function2(value2);
}

Basic Example

filter-blur.css
img {
  filter: blur(5px);
}
filter: blur(5px); filter: grayscale(100%); filter: brightness(120%); filter: contrast(150%); filter: drop-shadow(0 4px 8px #000);

Default Value

The default value for the filter property is none, which means no filter effects are applied.

Syntax Rules

  • Chain multiple functions in one filter declaration, separated by spaces.
  • Order matters — filters are applied left to right.
  • The property is not inherited; set it on each element you want to affect.
  • Use the separate opacity property instead of filter: opacity() for transparency.
  • drop-shadow() follows the visible shape of the element, unlike box-shadow.

⚡ Quick Reference

QuestionAnswer
Initial valuenone
Applies toAll elements
InheritedNo
AnimatableYes (when using filter functions that accept numbers)
Common useImages, icons, cards, hover effects

💎 Property Values

The filter property accepts filter functions and the keyword none:

ValueDescription
noneDefault value. No filter effects are applied.
blur(px)Applies a Gaussian blur to the element. The px value defines the radius of the blur.
brightness(%)Adjusts the brightness of the element. 0% is completely dark, 100% is the original brightness.
contrast(%)Adjusts the contrast of the element. 0% is completely gray, 100% is the original contrast.
grayscale(%)Converts the element to grayscale. 0% is original color, 100% is fully grayscale.
invert(%)Inverts the colors of the element. 0% is original, 100% is fully inverted.
opacity(%)Adjusts transparency through the filter. Prefer the opacity property for most cases.
saturate(%)Saturates the colors. 0% is unsaturated, 100% is original saturation.
sepia(%)Applies a sepia tone. 0% is original, 100% is fully sepia.
drop-shadow(offset-x offset-y blur-radius color)Applies a drop shadow. Offset, blur radius, and color define the shadow appearance.

filter vs backdrop-filter

PropertyWhat it affectsTypical use
filterThe element and its contentsBlurring an image, grayscale photo, icon effects
backdrop-filterThe area behind the elementFrosted glass panels, modal overlays, nav bars

👀 Live Preview

The same gradient box with different filter functions applied:

none
blur(4px)
grayscale
brightness
sepia
drop-shadow

Examples Gallery

In this example, we’ll apply a blur effect to an image — plus grayscale, brightness and contrast, chained filters, and drop-shadow.

🎨 Basic Filter Effects

Start with the reference example — a blur effect on an image element.

Example 1 — Blur an Image

Apply a soft Gaussian blur to an image without editing the source file.

filter-blur.html
<style>
  img {
    filter: blur(5px);
  }
</style>

<h1>Image with Blur Effect</h1>
<img src="photo.jpg" alt="Blurred image">
Try It Yourself

How It Works

blur(5px) softens the entire rendered element. Larger pixel values create a stronger blur.

Example 2 — Grayscale on Hover

Convert a colorful image to black and white, then restore color on hover.

filter-grayscale.css
.photo {
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.photo:hover {
  filter: grayscale(0%);
}
Try It Yourself

How It Works

grayscale(100%) removes all color. Animating back to 0% on hover creates a smooth reveal effect.

🛠 Combined & Shadow Effects

Chain multiple filter functions or use drop-shadow() for shape-aware shadows.

Example 3 — Brightness and Contrast

Boost brightness and contrast together for a punchier photo look.

filter-brightness.css
.hero-photo {
  filter: brightness(110%) contrast(120%);
}
Try It Yourself

How It Works

Filters are applied in order. Here, brightness runs first, then contrast sharpens the result.

Example 4 — Drop Shadow on an Icon

Use drop-shadow() to add a shadow that follows the visible shape of PNG or SVG content.

filter-drop-shadow.css
.logo {
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.35));
}
Try It Yourself

How It Works

Unlike box-shadow, which draws around the element’s box, drop-shadow() follows transparent areas in images and icons.

♿ Accessibility

  • Do not rely on color alone — grayscale or invert filters can remove color cues; keep text labels clear.
  • Check contrast after filtering — brightness and contrast changes can make text harder to read.
  • Avoid heavy blur on important content — blurred text or controls may be unreadable for some users.
  • Respect reduced motion — consider disabling animated filter transitions with prefers-reduced-motion.
  • Provide alt text on images — filters change appearance but not the meaning conveyed by alt text.

🧠 How filter Works

1

Element is rendered normally

The browser draws the element and its children into a bitmap layer.

Rendering
2

Filter functions are applied

Each function in the filter list transforms the layer from left to right.

Processing
3

Final result is displayed

The filtered output replaces the original appearance on screen.

Display
=

Enhanced visuals

Photos, icons, and UI elements gain effects without extra image files.

🖥 Browser Compatibility

The filter property is widely supported in modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it’s always a good practice to test your website across different browsers to ensure compatibility.

Baseline · Modern browsers

Filters in today’s browsers

Standard filter functions work in all current browser versions. Some older browsers needed vendor prefixes, but prefixes are no longer required in modern CSS.

97% Modern browser support
Google Chrome 53+ · Desktop & Mobile
Full support
Mozilla Firefox 35+ · Desktop & Mobile
Full support
Apple Safari 9.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 40+ · Modern versions
Full support
filter property 97% supported

Bottom line: filter is safe for modern projects. Test complex chained filters on mobile devices for performance.

🎉 Conclusion

The filter property is a versatile tool for web developers to enhance the visual appeal of their websites. By applying various graphical effects, you can create unique and engaging user experiences.

Experiment with different filter functions and values to see how they can transform your web elements. Start with blur and grayscale, then explore chaining brightness, contrast, and drop-shadow.

💡 Best Practices

✅ Do

  • Use filter for quick image treatments and hover effects
  • Chain functions for richer looks: brightness() contrast() saturate()
  • Use drop-shadow() on icons with transparent backgrounds
  • Animate filters with transition for smooth hover states
  • Test performance on mobile when applying heavy blur

❌ Don’t

  • Use filter: opacity() when the opacity property is clearer
  • Apply strong blur to body text or form controls
  • Confuse filter with backdrop-filter for glass overlays
  • Overuse filters on large full-screen elements
  • Rely on inverted colors as the only way to show state

Key Takeaways

Knowledge Unlocked

Five things to remember about filter

Use these points when adding visual effects with CSS.

5
Core concepts
02

Default none

No effect.

Default
🔗 03

Chainable

Multiple functions.

Syntax
📷 04

Images & icons

Most common use.

Scope
🖼 05

drop-shadow

Shape-aware shadow.

Tip

❓ Frequently Asked Questions

The filter property applies graphical effects such as blur, brightness, contrast, grayscale, and drop-shadow directly to an element and everything inside it.
The initial value is none, which means no filter effects are applied and the element renders normally.
Yes. Chain filter functions in one declaration by separating them with spaces, such as filter: contrast(120%) saturate(140%) brightness(110%);.
filter affects the element itself and its contents. backdrop-filter affects only the area visible through the element, which is useful for frosted-glass overlays.
No. filter is applied to the whole rendered result of the element, including its children, as one visual layer.

Practice in the Live Editor

Open the HTML editor, add filter: blur(5px) to an image, and experiment with grayscale and brightness effects.

HTML Editor →

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.

5 people found this page helpful