opyeb SVGForge

Guides · Performance

SVG filters: what they cost, and how to keep the bill small

Updated 28 Nov 2026 · 8 min read

An SVG filter is a small image-processing graph. <feGaussianBlur> blurs, <feDropShadow> offsets and blurs a copy, <feColorMatrix> transforms channels, and <feTurbulence> generates noise. The browser evaluates that graph every time the filtered element needs repainting, and the cost grows with the area and the number of samples, which is why the same filter is cheap on a 16 px icon and expensive on a full-width hero image.

Filters also break the cheap compositing path. A blurred layer cannot be reused as a simple texture on the GPU in the same way, and a filter applied to an element that changes on every frame forces the filter to be recomputed. On a low-end phone this is where a smooth animation becomes a slideshow.

FilterRelative costBetter alternative
feGaussianBlur, small radiusModeratePre-blurred raster or a soft gradient
feGaussianBlur, large radiusHighBake into the image or use CSS blur on a small layer
feDropShadowModerate to highA duplicated offset shape at low opacity
feTurbulenceHighA tiled raster texture or a fixed pattern
feColorMatrixLowKeep it if the colour effect is needed
feMorphologyModerateStroke on a duplicated shape

Filter regions are part of the cost

Every filter has a region: the rectangle it is allowed to paint. The default is a box 10% larger than the object's bounding box on each side, expressed in object bounding box units. A shadow offset of 8 units on a 24 unit icon falls outside that default and is clipped. Increase the region, and the cost grows with it, because the browser processes the larger area. Set the smallest region that contains the visible result.

Use filterUnits="userSpaceOnUse" when the filtered object may be scaled or when you want the region to stay fixed. In object bounding box units the region scales with the object, which is usually what you want for an icon but not for a diagram where the blur radius is in user units.

Practical rules

First, do not filter text that changes size with the viewport. A blurred heading recomputed on every resize is visible jank. Second, avoid filters on elements that animate transform or opacity; if the filter is static, put it on a parent that does not animate. Third, prefer a duplicated shape with a low opacity for a simple shadow on an icon: it is a paint operation, not a convolution.

Finally, check whether the filter is used at all. Unused <filter> definitions inside <defs> are common in exported files, and they contribute nothing but bytes. Removing an unused filter is one of the safest savings available, and an optimiser that reports defs it removed will show it.

Rendering differences exist between browsers for filter primitives. If a filter is essential to the design, compare it in Chrome, Firefox and Safari before shipping; a colour matrix that looks right in one engine can be washed out in another.

Sources

Questions

Is an SVG blur expensive?

Yes. A Gaussian blur samples the surrounding pixels for every output pixel, and the cost grows with the blur radius and the filter region. On a large element it can take milliseconds per frame and prevent the layer from being composited cheaply. Use it on small areas or pre-render it into the image.

Why is my drop shadow cut off?

A filter only paints inside its filter region, which defaults to a box slightly larger than the object's bounding box. A shadow offset beyond that box is clipped. Set x, y, width and height on the filter element, or use filterUnits="userSpaceOnUse" with explicit bounds.

Can I use CSS box-shadow on an SVG?

On an inline SVG element, CSS box-shadow applies to the element's box, not to the drawn shape, so it produces a rectangle. For a shape shadow you need an SVG filter or a duplicated shape with a blur. On a small icon, a duplicated offset shape is often cheaper and more predictable.

Paste a filtered SVG into the optimizer and compare the file size before and after removing unused defs.

Open the optimizer

Written against the W3C SVG specifications, MDN and the React and WCAG documentation; every sample in the examples can be pasted into the optimizer linked above.

Back to the guides