SVG favicon guide

Written by

SVG keeps edges sharp at every pixel density and can adapt colors to the theme. That flexibility comes with one constraint: the file must remain self-contained, simple and readable in a tiny space.

Square vector path shown on light and dark backgrounds
Simple, self-contained and well-framed artwork remains readable at tab sizes.

Build a square with a viewBox

Use a square viewBox, such as 0 0 64 64, and leave padding around the symbol. The viewBox defines the coordinate system without imposing a physical rendered size.

Reduce the artwork to its distinctive shapes. Fine details, tiny counters and full words often disappear at 16 pixels even though the vector file remains technically sharp.

SVG favicon checklist
ItemWhyTest
Square viewBoxPredictable crop16×16 preview
Simple pathsReadabilityLight and dark tabs
No dependenciesSelf-contained loadOffline network
ICO fallbackOlder clientsRoot URL

Make the file self-contained

Embed required styles inside the SVG. Convert text to paths when the symbol depends on a typeface, because an external web font is not a reliable dependency in this context.

Remove scripts, remote links and unnecessary editor metadata. Simple shapes and styles also make security review easier and reduce file size.

Finally, open the file by itself in a browser and test it offline. If the artwork changes or disappears, it still depends on an external resource that must be embedded or replaced.

Declare SVG with a fallback

Add link rel icon with type image/svg+xml and a root-relative URL. Also keep favicon.ico at the root for clients that do not select SVG or request ICO directly.

SVG does not replace the Apple Touch icon or manifest icons. Export opaque or maskable PNG files for those interfaces.

Adapt colors to the theme

A prefers-color-scheme rule inside a style element can change fill or stroke in dark mode. Define a robust default color first, then add the variant as progressive enhancement.

Test the file in real tabs and at several zoom levels. Also inspect the fallback when SVG is not selected: an ICO that disappears on a dark background remains a problem for those clients.

Primary sources

Frequently asked questions

Does an SVG need width and height?

A square viewBox is the essential part for scaling. Explicit width and height can be included, but the browser sizes the icon for its context.

Can it load an external font?

Do not rely on it. Convert lettering to paths for a self-contained and predictable file.

Is SVG enough for iOS?

No. Provide a separate opaque PNG Apple Touch icon for the home screen.

Put it into practice

The generator produces the complete set in seconds, for free, and without uploading your images.

Create an SVG favicon and its fallbacks

What to read and try next

The other LFFavicon tools, and the guides that answer the questions people ask most.

Tools

Guides