Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. filter

filter

Applies various filter effects to elements such as images and text. Originally an IE-specific feature, it became available in other browsers with CSS3, using a different syntax. Depending on the browser version, you may need to specify the vendor prefixes -webkit- or -moz-. Using multiple filters or applying them to large elements (such as page backgrounds) may slow down page loading.

IE10 and IE11 do not support this property, so vendor prefixes will not help in those browsers. Each filter's numeric value uses a reference of 1 (or 100%) as the standard. For example, 'brightness(1.5)' means 1.5 times the original brightness.

Sample Code

style.css
/* blur */
filter: blur(5px);

/* brightness (1.0 = original, 1.5 = 1.5x brighter) */
filter: brightness(1.5);

/* contrast (100% = original, 200% = enhanced) */
filter: contrast(200%);

/* grayscale (0% = color, 100% = full gray) */
filter: grayscale(100%);

/* sepia */
filter: sepia(80%);

/* hue rotation */
filter: hue-rotate(90deg);

/* invert colors */
filter: invert(100%);

/* opacity */
filter: opacity(0.5);

/* drop shadow (x, y, blur, color) */
filter: drop-shadow(4px 4px 8px rgba(0,0,0,0.5));

/* combining multiple filters */
filter: brightness(1.2) contrast(110%) saturate(130%);

/* older browser support (vendor prefix) */
-webkit-filter: blur(5px); /* For older versions of Chrome and Safari */
filter: blur(5px);

Available Values

ValueDefaultEffect
brightness()1.0Brightness
blur()0pxBlur
contrast()100%Contrast
grayscale()0%Grayscale
hue-rotate()0degHue rotation
invert()0pxColor inversion
saturate()100%Saturation
sepia()0%Sepia
opacity()1.0Opacity
drop-shadow()noneDrop shadow

Browser Preview

The samples below apply filter effects to the following image.

img{
	-webkit-filter: brightness(1.5);
	-moz-filter: brightness(1.5);
	filter: brightness(1.5);
}

img{
	-webkit-filter: blur(5px);
	-moz-filter: blur(5px);
	filter: blur(5px);
}

img{
	-webkit-filter: contrast(200%);
	-moz-filter: contrast(200%);
	filter: contrast(200%);
}

img{
	-webkit-filter: grayscale(100%);
	-moz-filter: grayscale(100%);
	filter: grayscale(100%);
}

img{
	-webkit-filter: hue-rotate(180deg);
	-moz-filter: hue-rotate(180deg);
	filter: hue-rotate(180deg);
}

img{
	-webkit-filter: invert(40%);
	-moz-filter: invert(40%);
	filter: invert(40%);
}

img{
	-webkit-filter: saturate(200%);
	-moz-filter: saturate(200%);
	filter: saturate(200%);}

img{
	-webkit-filter: sepia(100%);
	-moz-filter: sepia(100%);
	filter: sepia(100%);}

img{
	-webkit-filter: opacity(0.5);
	-moz-filter: opacity(0.5);
	filter: opacity(0.5);}

img{
	-webkit-filter: drop-shadow(5px 5px 5px red);
	-moz-filter: drop-shadow(5px 5px 5px red);
	filter: drop-shadow(5px 5px 5px red);

Browser Compatibility

Chrome Chrome
53+
52
51
50
49
48
47
46
45
↑ Requires prefix '-webkit-'
17 or earlier ×
Firefox Firefox
35+
34 or earlier ×
Safari Safari
9.1+
8
7
6
↑ Requires prefix '-webkit-'
5 or earlier ×
Edge Edge
12+
IE IE
11 ×
10 ×
9 ×
8 ×
7 ×
6 ×
Opera Opera
40+
39
38
37
36
35
34
33
32
↑ Requires prefix '-webkit-'
14 or earlier ×
iOS Safari iOS Safari
9.3+
8
7
6
↑ Requires prefix '-webkit-'
5 or earlier ×
Android Android Browser
53+
4.4
↑ Requires prefix '-webkit-'
3 or earlier ×
Chrome Android Chrome Android
Latest
Same support as desktop version
Firefox Android Firefox Android
Latest
Same support as desktop version

※ Version data based on MDN / Can I Use.

※ Supported from Android 5 standard browser onwards.

※ IE9 and earlier use a different syntax — see the overview below.

Overview

Applies various filter effects to elements such as images and text.

This property was originally IE-specific. For IE9 and earlier, you must use the syntax progid:DXImageTransform.Microsoft.FilterName() instead of the CSS3 syntax described above. The available filter types and values also differ.

Values available for IE9 and earlier

ValueEffect
Blur(PixelRadius=number)Blur
gradient()Gradient
alpha(opacity=number)Opacity

※ The samples below use IE9-specific syntax. Check them with IE developer tools.

img{
	filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=80);
}

The gradient() function has the same effect as CSS linear-gradient(), but with limited options — you can only specify the start color, end color, and direction (horizontal or vertical). Radial gradients like radial-gradient() are not supported. Use the syntax progid:DXImageTransform.Microsoft.gradient(startColorstr="start-color", endColorstr="end-color", GradientType=0). Set GradientType to 0 for vertical and 1 for horizontal (defaults to vertical if omitted).

div{
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ff0000", endColorstr="#ffffff",GradientType=1);
}

For opacity, you can use the simpler syntax filter:alpha(opacity=number) without the progid prefix. This provides the same effect as opacity and works in IE9.

img{
	filter:alpha(opacity=70);
}

There are other IE-specific filter values, but they are no longer applied in modern browsers.

If you find any errors or copyright issues, please .