Introduction
Loading an entire 150KB icon font file like FontAwesome just to display 5 social media icons and a search magnifying glass is a classic web performance crime.
Icon fonts suffer from accessibility issues, Flash of Invisible Text, and blurry subpixel anti-aliasing.
Modern websites use Scalable Vector Graphics (SVG): they are crisp on Retina displays, fully accessible, and styled with CSS.
Here is how to structure SVG icons for maximum performance and maintainability.

The Problem with Raw Inline SVGs Everywhere
Inlining raw SVG code directly in HTML allows instant CSS color fills and avoids extra HTTP requests.
However, if you have a repeating icon (like a star rating or checkmark) inlined 50 times across a page, your HTML document size balloons unnecessarily.
Furthermore, inlined SVGs cannot be cached independently by the browser cache.
Reserve raw inline SVGs for unique logos or dynamic icons that require complex CSS animations.
The SVG Symbol Sprite Sheet Architecture
The most efficient architecture is an external SVG sprite sheet containing all site icons wrapped in <symbol id="icon-name"> tags.
In your HTML markup, render the icon cleanly using: <svg class="icon"><use href="/assets/icons.svg#icon-name"></use></svg>.
The browser downloads the sprite sheet once, caches it in browser memory, and references icons across all pages instantly.
It keeps your HTML code remarkably clean and maintainable.
Stripping Bloat with SVGO
Raw vector exports from Figma or Illustrator are loaded with metadata bloat: editor comments, unnecessary namespaces, empty groups, and overly precise decimal points.
Run all vector files through SVGO (SVG Optimizer) before deploying to production.
SVGO typically reduces raw SVG file sizes by 50% to 70% with zero loss in visual fidelity.
Ensure currentColor is used for fill and stroke attributes so icons inherit parent typography colors automatically.
Frequently Asked Questions
How do I make SVG icons accessible to screen readers?: Add aria-hidden="true" to decorative icons; for interactive icon buttons without text, add aria-label="Search" to the parent button.
Can SVG sprites be cached across pages?: Yes! When referenced via an external URL (icons.svg#name), browsers cache the file just like an image or stylesheet.
Why did modern web development abandon icon fonts?: Icon fonts fail when fonts are blocked by ad blockers or network errors, rendering empty boxes (tofu) instead of icons.