ximg.es

CSS filters for images

Move the sliders or pick a preset and copy the filter property. Use “Show original” to compare before and after.

Presets
Sample photo with the filters applied
Sample photo from the ximg.es library: /random/960x640.jpg?seed=ximg-filtros

CSS code

.imagen {
  filter: brightness(110%) contrast(90%) sepia(50%) saturate(80%);
}
0px
110%
90%
0%
50%
80%
0deg
0%
100%
0px

How filter works

The filter property applies graphic effects to an element when the browser paints it: the image file itself doesn’t change. Several functions can be chained, separated by spaces, and order matters: each one is applied to the result of the previous one. This tool always writes them in the same order.

Common uses

Server-side filters with /random

ximg.es random photos accept two filters in the URL itself, applied when the image is generated: ?grayscale for black and white and ?blur=1…10 to blur. The difference from CSS is that the image arrives already filtered, so there’s no painting cost and it works where you don’t control the CSS, such as an email:

<img src="https://ximg.es/random/800x600?seed=cover&grayscale&blur=3" alt="">

More image options in the generator.

Performance

Colour filters are cheap. blur() and drop-shadow() with large radii cost more, especially when animated or on many elements at once. If a filter never changes and the image is yours, it can pay to apply it on export.

Frequently asked questions

How do I make an image black and white with CSS?

With filter: grayscale(100%);. If you want it to get its colour back on hover, add :hover { filter: none; } and a transition so the change is smooth.

How do I blur an image with CSS?

With filter: blur(4px);. The blur spills slightly past the edges; if that bothers you, put the image in a container with overflow: hidden.

What is the difference between filter and backdrop-filter?

filter affects the element itself and its content. backdrop-filter affects what’s behind the element, and it’s what’s used for the frosted glass effect.

In what order are filters applied?

Left to right, each one on the result of the previous one. sepia(100%) hue-rotate(90deg) doesn’t give the same result as hue-rotate(90deg) sepia(100%).

What is the difference between drop-shadow and box-shadow?

box-shadow follows the element’s rectangular box. drop-shadow() follows the actual shape of what you see, so on a PNG or SVG with transparency the shadow has the outline of the drawing.

Do CSS filters work in every browser?

Yes, filter works in every current browser, on desktop and mobile, with no prefixes.

More tools

See all tools · Placeholder image generator