<feGaussianBlur>

Adds a Gaussian blur to an SVG tag on an HTML page.
2 min read
Believemy logo

The <feGaussianBlur> tag is a primitive filter SVG that applies a Gaussian blur effect to a graphic element.

Good to know

This effect is useful for creating soft edges, transitions, or simply blurring objects to draw attention to other elements.

 

Structure and syntax of the <feGaussianBlur> tag

Structure

This tag is always used with the <svg> tag.

Here is a basic example:

HTML
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <filter id="blurEffect">
            <feGaussianBlur in="SourceGraphic" stdDeviation="5" />
        </filter>
    </defs>

    <circle cx="100" cy="100" r="50" fill="blue" filter="url(#blurEffect)" />
</svg>

In this example:

  • The <feGaussianBlur> tag applies a blur with a stdDeviation of 5.
  • The filter is applied to the circle with filter="url(#blurEffect)" on the <circle> tag.

Here is the result:

 

Advanced example

Here is an example combining multiple filters to achieve a blur and shadow effect:

HTML
<svg width="300" height="200" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <filter id="complexBlur">
            <feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur" />
            <feOffset in="blur" dx="5" dy="5" result="offsetBlur" />
            <feMerge>
                <feMergeNode in="offsetBlur" />
                <feMergeNode in="SourceGraphic" />
            </feMerge>
        </filter>
    </defs>

    <rect x="50" y="50" width="100" height="100" fill="orange" filter="url(#complexBlur)" />
</svg>

In this example:

  • <feGaussianBlur> creates a blur from the alpha of the source;
  • <feOffset> offsets the blur to simulate a shadow;
  • <feMerge> combines the blur and the source graphic.

Try it yourself:

 

Attributes of the <feGaussianBlur> tag

The <feGaussianBlur> tag accepts several attributes:

AttributeDescription
inSpecifies the source of the graphic to blur. For example, SourceGraphic, SourceAlpha, etc.
stdDeviationControls the intensity of the blur. The higher the value, the more important the blur. You can specify two values separated by a space (x and y).
resultDefines an identifier for the result of this filter step, which can be used by other primitives.

 

Best practices

To use <feGaussianBlur> effectively, avoid excessively high values of stdDeviation to prevent overly intense or subtle blurs.

Do not hesitate to combine <feGaussianBlur> with other primitives for advanced visual effects: filters can accumulate in their filter tag! 😉

 

Browser compatibility

The <feGaussianBlur> tag is widely supported by modern browsers:

BrowserCompatibility
ChromeYes
FirefoxYes
SafariYes
EdgeYes
Internet ExplorerPartial (IE 9+)

Related terms

Discover our hTML and CSS glossary

Browse the terms and definitions most commonly used in HTML and CSS development.

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.