Chapter 19: SVG Blur Effects
SVG Blur Effects, which are one of the most popular and easiest-to-understand parts of SVG filters!
I’m your friendly teacher here, so we’ll go slow, step by step, with lots of copy-paste examples. By the end, you’ll understand how to make things look soft, dreamy, out-of-focus, glowing, or even create realistic drop shadows using blur.
What are SVG Blur Effects?
In SVG, the main way to create blur is with the <feGaussianBlur> filter primitive (the “fe” stands for “filter effect”).
- It applies a Gaussian blur — a very smooth, natural-looking blur (the same kind used in Photoshop, GIMP, CSS filter: blur(), etc.).
- The blur is based on a mathematical “bell curve” (Gaussian distribution) — pixels near the center affect the result more strongly, and the influence fades smoothly outward.
- Higher blur amount → softer / more dreamy look
- Lower blur amount → subtle softening / anti-aliasing effect
This is not the same as CSS filter: blur() — SVG blur is more flexible:
- You can blur only the alpha channel (shape outline) → perfect for shadows
- You can chain it with other effects (offset for shadows, merge for glows)
- You control horizontal vs vertical blur separately
- Works on shapes, text, images, groups — anything in SVG
The Key Element: <feGaussianBlur>
It almost always lives inside a <filter> in <defs>.
Core attributes:
| Attribute | What it does | Typical values | Default | Super important? |
|---|---|---|---|---|
| stdDeviation | Amount of blur (standard deviation of the Gaussian) | number (e.g. “3”, “8”, “12”) or “x y” for different horizontal/vertical | 0 | ★★★★★ |
| in | What to blur | “SourceGraphic” (full color), “SourceAlpha” (only shape/transparency) | SourceGraphic | ★★★★☆ |
| result | Name for this blur’s output (so next primitive can use it) | “blur”, “soft”, “shadowBlur” | (auto) | ★★★★☆ (when chaining) |
| edgeMode | How to handle edges (rarely changed) | “duplicate”, “wrap”, “none” | “none” | ★★☆☆☆ |
Most common pattern (simple uniform blur):
|
0 1 2 3 4 5 6 7 8 |
<filter id="blurFilter"> <feGaussianBlur stdDeviation="6" /> </filter> |
→ stdDeviation=”6″ means roughly 6 units of blur radius (higher = more blur)
Example 1 – Basic Blur on a Shape
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<svg width="400" height="220" style="border:1px solid #eee; background:#f9f9f9;"> <defs> <filter id="softBlur"> <feGaussianBlur stdDeviation="8" /> </filter> </defs> <circle cx="120" cy="110" r="80" fill="#4CAF50" /> <circle cx="280" cy="110" r="80" fill="#4CAF50" filter="url(#softBlur)" /> <text x="200" y="200" font-size="28" text-anchor="middle"> Left = sharp • Right = blurred </text> </svg> |
Result: Left circle crisp, right one soft and dreamy.
Try changing stdDeviation to 2, 5, 12, 25 — see how it grows.
Here are some visual examples showing different blur strengths (imagine seeing these side by side):
- Very light blur (stdDeviation ≈ 2–4) → subtle softening
- Medium (6–10) → obvious soft focus
- Heavy (15+) → strong blur, almost abstract
Example 2 – Directional Blur (horizontal vs vertical – very useful!)
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<svg width="500" height="240"> <defs> <filter id="horizBlur"> <feGaussianBlur stdDeviation="12 2" /> <!-- 12 horizontal, only 2 vertical --> </filter> <filter id="vertBlur"> <feGaussianBlur stdDeviation="2 12" /> </filter> <filter id="motionBlur"> <feGaussianBlur stdDeviation="18 0" /> <!-- pure horizontal – fake motion --> </filter> </defs> <text x="250" y="60" font-size="48" text-anchor="middle" fill="#2196F3"> Normal Text </text> <text x="250" y="120" font-size="48" text-anchor="middle" fill="#2196F3" filter="url(#horizBlur)"> Horizontal Blur </text> <text x="250" y="180" font-size="48" text-anchor="middle" fill="#2196F3" filter="url(#vertBlur)"> Vertical Blur </text> <text x="250" y="240" font-size="48" text-anchor="middle" fill="#F44336" filter="url(#motionBlur)"> Motion Effect! </text> </svg> |
This is great for:
- Fake motion blur (strong horizontal, zero vertical)
- Soft focus only in one direction
- Artistic typography effects
Example 3 – Blur only the shape outline (SourceAlpha) – foundation for shadows & glows
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<svg width="320" height="220"> <defs> <filter id="glow"> <feGaussianBlur in="SourceAlpha" stdDeviation="10" result="blur"/> <!-- We'll add color & merge in next lessons --> <feMerge> <feMergeNode in="blur"/> <feMergeNode in="SourceGraphic"/> </feMerge> </filter> </defs> <circle cx="160" cy="110" r="70" fill="#673AB7" filter="url(#glow)" /> </svg> |
→ By using in=”SourceAlpha”, we blur only the transparency/shape, not the colors inside → perfect base for glows or outer shadows.
Quick Cheat Sheet – Blur Amounts Guide
| stdDeviation value | Typical visual feel | Common use case |
|---|---|---|
| 0–2 | Almost no blur / slight softening | Anti-aliasing, subtle edge glow |
| 3–6 | Noticeable soft focus | Soft buttons, dreamy icons |
| 7–12 | Strong blur / glow base | Drop shadows, outer glows |
| 15–30 | Heavy / abstract blur | Background bokeh, motion blur |
| “12 3” | Directional (strong horizontal) | Fake speed/motion effect |
Common beginner mistakes
- stdDeviation=”0″ → no blur at all (invisible effect)
- Forget to expand filter region → blur gets clipped at edges → add x=”-50%” y=”-50%” width=”200%” height=”200%” to <filter>
- Use on <line> without thick stroke → almost invisible blur
- Expect CSS-like blur(5px) → SVG units are user units (often ≈ pixels, but depends on viewBox)
- No filter=”url(#id)” on target element → nothing happens!
Mini practice tasks
- Blur a photo (<image>) with stdDeviation=”4″ vs “12” — compare softness
- Make text with horizontal-only blur (like fast movement)
- Create a simple glow around a star: blur SourceAlpha + merge with original
Paste your code here if you want feedback — I’ll review it like we’re debugging together 😊
This is the foundation of blur in SVG — next we can build drop shadows, glows, soft inner shadows, or even motion blur animations using this primitive.
Which direction excites you most? Shadows with blur? Glow effects? Directional blur tricks? Just tell me — we’ll go deeper with more fun examples! 🚀
