SVG Favicons: The Modern Approach to Scalable Browser Icons
Here's something that frustrates me about most favicon guides: they treat SVG favicons as some futuristic technology that's "not quite ready yet." That advice was reasonable in 2018. In 2024, it's holding people back from using the best favicon format available.
SVG favicons offer genuine advantages—infinite scalability, tiny file sizes, CSS styling capabilities, and native dark mode support. And as of now, browser support has crossed the threshold where SVG favicons make sense for most websites.
But there are nuances. Trade-offs. Implementation details that trip people up. This guide covers all of it.
What Makes SVG Favicons Different
Traditional favicons use raster formats—ICO files containing bitmap images at specific pixel dimensions, or PNG files at fixed sizes. When you create a 32x32 PNG favicon, that's exactly 32 pixels by 32 pixels. Scale it up, and it gets blurry. Scale it down, and you lose detail.
SVG (Scalable Vector Graphics) works entirely differently. Instead of storing pixel data, SVG files contain mathematical instructions describing shapes, paths, and colors. Your browser reads these instructions and renders the image at whatever size it needs, always crisp, always sharp.
For favicons specifically, this means:
A single SVG file replaces multiple PNG sizes. Instead of creating separate 16x16, 32x32, 48x48, and 192x192 versions, one SVG handles everything. The browser renders it perfectly at each size.
File sizes are often smaller. A well-optimized SVG favicon typically weighs 1-5KB. Compare that to serving multiple PNG files that might total 20-50KB combined.
You can use CSS inside the SVG. This is where things get interesting. SVG favicons can contain embedded CSS, including media queries. That means your favicon can automatically adapt to the user's dark mode preference—something impossible with raster formats.
They stay crisp on high-DPI displays. Retina screens, 4K monitors, whatever comes next—SVG favicons always render at native resolution.
Browser Support: The Real Picture
Let me give you the actual browser support data, not vague reassurances:
Full SVG favicon support:
- Chrome 80+ (released February 2020)
- Firefox 41+ (released September 2015)
- Edge 80+ (Chromium-based, released February 2020)
- Opera 67+ (released March 2020)
- Safari 12+ on macOS (released September 2018)
No support:
- Internet Explorer (all versions)
- Safari on iOS (all versions as of iOS 17)
- Some older Android browsers
That iOS Safari limitation is the big one. As of late 2024, iOS Safari still doesn't support SVG favicons. The icon simply won't appear in Safari tabs on iPhones and iPads if you only provide an SVG.
This doesn't mean you shouldn't use SVG favicons—it means you need a fallback strategy.
The Practical Implementation Strategy
The solution is straightforward: use SVG as your primary favicon with ICO or PNG fallbacks for browsers that don't support it. Here's the HTML that works:
<!-- SVG favicon for modern browsers -->
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<!-- ICO fallback for legacy browsers and iOS Safari -->
<link rel="icon" href="/favicon.ico" sizes="32x32">
<!-- Apple Touch Icon (required for iOS home screen) -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
The order matters. Browsers read these declarations top-to-bottom and use the first format they support. Modern browsers grab the SVG; older ones fall back to the ICO.
Note the type="image/svg+xml" attribute on the SVG link. While not strictly required in all browsers, it helps browsers identify the file type before downloading it, which can improve performance.
Why ICO for the Fallback?
You might wonder why I recommend ICO over PNG for the fallback. Two reasons:
-
ICO files can contain multiple sizes. A single favicon.ico can embed 16x16, 32x32, and 48x48 versions. The browser picks the appropriate one.
-
Maximum legacy compatibility. ICO is the original favicon format. Every browser that supports favicons at all supports ICO, including ancient versions of IE.
If your audience definitely doesn't include legacy browser users, a PNG fallback works fine:
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="icon" href="/favicon-32x32.png" sizes="32x32" type="image/png">
Creating an SVG Favicon That Actually Works
Not every SVG makes a good favicon. I've seen beautifully crafted SVG logos that look terrible as favicons because they weren't optimized for small-scale display.
Keep It Simple
At 16x16 or 32x32 pixels, complexity becomes visual noise. Your SVG favicon should be:
- Bold shapes over fine details. Thin lines disappear at small sizes.
- High contrast. Subtle color variations get lost.
- Minimal elements. If your logo has text, it won't be readable. Use just the icon or lettermark.
Optimize the ViewBox
Every SVG has a viewBox attribute that defines its coordinate system. For favicons, keep it simple:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<!-- Your paths here -->
</svg>
A 32x32 viewBox works well because it's the most common favicon display size in browser tabs. The browser will scale it smoothly to other sizes.
Remove Unnecessary Code
SVG files exported from design tools like Illustrator, Figma, or Sketch often contain bloat—metadata, unnecessary attributes, and redundant groups. Strip these out.
Before optimization:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 32 32"
style="enable-background:new 0 0 32 32;" xml:space="preserve">
<style type="text/css">.st0{fill:#FF6B35;}</style>
<g id="icon">
<path class="st0" d="M16,2L4,28h24L16,2z"/>
</g>
</svg>
After optimization:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<path fill="#FF6B35" d="M16 2L4 28h24z"/>
</svg>
Tools like SVGO can automate this optimization. A well-optimized SVG favicon is typically under 1KB.
Dark Mode Support: The Killer Feature
This is where SVG favicons truly shine. You can embed CSS media queries directly in the SVG file that respond to the user's system color scheme preference.
Here's a practical example:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
path { fill: #1a1a1a; }
@media (prefers-color-scheme: dark) {
path { fill: #ffffff; }
}
</style>
<path d="M16 2L4 28h24z"/>
</svg>
When a user has dark mode enabled on their device, the favicon automatically switches from dark to light. No JavaScript required, no separate files to manage—it just works.
This matters more than you might think. A dark favicon on a dark browser tab bar becomes invisible. Users can't find your tab. With dark mode adaptation, your brand stays visible regardless of the user's system preferences.
More Advanced Dark Mode Techniques
You're not limited to simple color swaps. You can adjust multiple elements differently:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
.primary { fill: #FF6B35; }
.secondary { fill: #1a1a1a; }
@media (prefers-color-scheme: dark) {
.primary { fill: #FF8C5A; }
.secondary { fill: #ffffff; }
}
</style>
<circle class="primary" cx="16" cy="16" r="14"/>
<path class="secondary" d="M10 16h12M16 10v12"/>
</svg>
This example brightens the primary brand color in dark mode (important for contrast) while inverting the secondary element.
Testing Dark Mode Favicons
To test your dark mode favicon without changing your system settings:
Chrome DevTools: Open DevTools → Press Cmd/Ctrl+Shift+P → Type "Render" → Select "Rendering" → Find "Emulate CSS media feature prefers-color-scheme" and toggle between light and dark.
Firefox: Type about:config in the address bar → Search for ui.systemUsesDarkTheme → Set to 1 for dark, 0 for light.
Refresh the page after changing the setting to see your favicon update.
Common SVG Favicon Mistakes
After seeing hundreds of SVG favicon implementations, these issues come up repeatedly:
Mistake 1: Using Embedded Raster Images
Some people export an SVG that actually contains an embedded PNG or JPEG. This defeats the entire purpose—you get the worst of both worlds (SVG file overhead plus raster limitations).
Check your SVG source code. If you see <image xlink:href="data:image/png;base64,...">, you don't have a true vector favicon.
Mistake 2: Forgetting the xmlns Attribute
The SVG must include xmlns="http://www.w3.org/2000/svg" to work as a favicon. Without it, some browsers won't recognize the file as valid SVG.
<!-- Wrong -->
<svg viewBox="0 0 32 32">...</svg>
<!-- Right -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">...</svg>
Mistake 3: Using External Resources
SVG favicons can't load external stylesheets, fonts, or images. Everything must be embedded. If your SVG references a Google Font or external CSS file, those won't load when the SVG is used as a favicon.
Mistake 4: Relying Only on SVG
Until iOS Safari supports SVG favicons, you need fallbacks. I've seen sites with beautiful SVG favicons that show nothing on iPhones—a significant portion of their traffic.
Mistake 5: Not Testing Across Browsers
Just because your SVG looks perfect in Chrome doesn't mean it renders identically everywhere. Firefox and Safari have subtle differences in SVG rendering. Test your favicon across browsers before deploying.
PWA Considerations for SVG Favicons
If you're building a Progressive Web App, there's a catch: the Web App Manifest currently doesn't support SVG icons. You need PNG icons in your manifest:
{
"name": "Your App",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
This limitation means PWAs still require PNG icons for install prompts, splash screens, and home screen icons. Use SVG for the browser tab favicon, but maintain PNGs for PWA functionality.
The good news: you can generate these PNGs from your SVG master file, ensuring consistency across all icon sizes.
Should You Switch to SVG Favicons?
After all this, here's my honest assessment:
Use SVG favicons if:
- You want dark mode support
- You value crisp rendering on high-DPI displays
- You're already maintaining an SVG version of your logo/icon
- You're building a modern site primarily for modern browsers
Stick with PNG/ICO favicons if:
- A significant portion of your traffic comes from iOS Safari and you can't maintain fallbacks
- Your icon is photographic or uses complex gradients that don't translate well to vector
- You want the simplest possible implementation
For most websites in 2024, I recommend the hybrid approach: SVG primary with ICO/PNG fallbacks. You get the benefits of SVG where supported while maintaining universal compatibility.
Ready to create your perfect favicon? Our generator lets you explore dozens of unique favicon designs instantly—and exports all the formats you need, including optimized SVGs with dark mode support built in.
FAQ
Do SVG favicons work in all browsers?
Not quite all. SVG favicons work in Chrome 80+, Firefox 41+, Edge 80+, and Safari 12+ on macOS. They don't work in Internet Explorer or Safari on iOS. For universal compatibility, use an SVG favicon alongside ICO or PNG fallbacks.
Can I use gradients in SVG favicons?
Yes, SVG supports both linear and radial gradients. However, gradients with many stops or subtle transitions may not render well at 16x16 pixels. Test your gradient favicon at actual display sizes before committing to it.
How do I make my SVG favicon support dark mode?
Embed a CSS media query inside the SVG file using the <style> element. Use @media (prefers-color-scheme: dark) to define alternate colors that display when the user's system is in dark mode.
What's the ideal file size for an SVG favicon?
Aim for under 5KB, ideally under 2KB. Well-optimized SVG favicons with simple shapes often come in under 1KB. Use SVGO or similar tools to strip unnecessary metadata and optimize paths.
Why doesn't my SVG favicon show in Safari on my iPhone?
iOS Safari doesn't support SVG favicons as of iOS 17. You need to provide an ICO or PNG fallback, plus an Apple Touch Icon for the home screen. iOS will use these fallback files instead of the SVG.