CSS UTILITY

CSS Filter Generator

Apply and combine CSS filter effects visually. Adjust blur, brightness, contrast, grayscale, and more with real-time preview on a sample image.

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

Filter Preview

Adjust sliders to see effects

Generated CSS
filter: none;

Real-Time Visual Effects in the Browser

The Filter Pipeline

CSS filters process pixels in sequence, left to right. Each function receives the output of the previous one. filter: grayscale(1) brightness(1.5)first strips all color, then boosts the brightness of the gray image. Reversing the order — brightness(1.5) grayscale(1)— brightens the full-color image first, then desaturates it, producing a noticeably different result (washed-out whites vs. uniform gray). There are 10 built-in filter functions: blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia.

filter vs. backdrop-filter

filter applies effects to the element and all its children. A blur(5px) on a container blurs everything inside it. backdrop-filter applies effects to the area behindthe element, leaving its own content sharp. This is how Apple's frosted glass UI works: backdrop-filter: blur(20px) saturate(180%)on a semi-transparent background creates the classic glassmorphism effect. The element must have a transparent or semi-transparent background for backdrop-filter to be visible — a solid background color completely occludes the blurred backdrop.

Instagram-Style Color Grading

Combine filters to replicate popular photo effects. A warm vintage look: filter: sepia(0.3) contrast(1.1) brightness(1.1) saturate(1.3). A dramatic black & white: filter: grayscale(1) contrast(1.4). A cool blue tone: filter: saturate(0.8) hue-rotate(180deg) brightness(1.1). For duotone effects, combine grayscale with a colored overlay using a pseudo-element and mix-blend-mode. These filter chains apply in real-time to any element — images, videos, even live webcam feeds via a video element.

Performance Considerations

Filters are GPU-accelerated but the blur()function is the most expensive — it must sample surrounding pixels for each output pixel. A blur(20px) on a 1920x1080 element samples a 40px diameter for every pixel (over 2 million pixels). On mobile, keep blur values under 10px for smooth scrolling. Applying will-change: filterpromotes the element to its own compositing layer, preventing the filter from triggering repaints on siblings. For static blur effects (like a blurred background image), consider using a pre-blurred image instead — zero runtime cost.

Frequently Asked Questions

Can I apply a filter to just part of an element, like only the background?

The filter property applies to the entire element and its descendants — there is no way to target only the background. For background-only effects, use backdrop-filter on a child overlay, or apply the filter to a pseudo-element (::before) that holds the background image, leaving the main element's content unaffected.

How do I use filters to create a dark mode image treatment?

In dark mode, bright images can be jarring. Apply filter: brightness(0.8) contrast(1.1) to dim images slightly while maintaining detail. For a more dramatic effect, use filter: brightness(0.7) saturate(0.8). Some apps also use invert(1) hue-rotate(180deg) as a quick-and-dirty dark mode for entire pages, though this produces odd results on images (invert them back individually with the same filter).

What is the url() filter function for?

The filter: url(#svg-filter-id) function references an SVG filter defined in the DOM, unlocking effects impossible with CSS alone: displacement maps, color matrix transformations, morphological operations, turbulence noise, and more. SVG filters can create sophisticated effects like watercolor textures, glitch distortion, and custom color grading that go far beyond the 10 built-in CSS functions.