Icon Fonts vs SVG Sprites vs Inline SVG: 30-Icon Page Test
We served the same 30 icons as a font, a sprite, inline SVG and img tags, then measured bytes, paint time, real DOM nodes, slow-asset gaps and forced colors.
On this page
Use inline SVG when a page has few icons or the icons must appear with the first paint. Use an external sprite, cut down to the icons you actually use, when the same icons repeat across many pages on your own origin, and keep img tags for logos and icons that never change color.
An icon font is only worth keeping where an older system already depends on it. We built one page with the same 30 Lucide icons and delivered it four ways. We tested on 2026-11-05 in Chrome 156 on Linux, and the end of this post lists what we did not test.
Quick answer
- Fewest bytes on one page: inline SVG, 1,932 bytes in total. Sprite 2,302, icon font subset 6,790, img tags 7,745.
- Fewest bytes across a site: the sprite. It passes inline on the second page, because inline sends its icons again in every page of HTML.
- Fastest icons on a first visit: inline at 207 ms, sprite 360 ms, font 381 ms, img 584 ms, on a simulated slow phone. These gaps are small unless the asset is slow.
- Biggest mistake: shipping the whole set. The full Lucide font took 1,938 ms and 312 KB. The full sprite cost 477 ms on every repeat visit, even from cache.
- Sprite limits: a sprite cannot load from another origin, even with CORS headers. It also adds more real DOM nodes than inline SVG in Chrome, not fewer.
What each method is
All four draw the same picture. They differ in where the drawing lives and how much of the page's CSS can reach it.
Inline SVG puts the markup in the HTML. It needs no request and is ready when the HTML is.
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/>
<path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
</svg>An SVG sprite is one file holding many <symbol> elements, each with an id. A page draws one with <use>. You can build the file with our SVG sprite maker.
<!-- /assets/sprite.svg holds: <symbol id="house" viewBox="0 0 24 24">...</symbol> -->
<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<use href="/assets/sprite.svg#house"/>
</svg>Keep those attributes on the outer <svg>. We tried the common short form, <svg class="icon"><use href="sprite.svg#house"></use></svg>, with the sprite Lucide publishes. Its symbols carry no stroke settings, so the house rendered as a solid black shape.
An icon font maps each icon to a character in a private part of Unicode.
@font-face {
font-family: icons;
src: url(/assets/icons.woff2) format("woff2");
}
.icon { font: normal 24px/1 icons; display: inline-block; width: 24px; height: 24px; }
.icon-house::before { content: "\e0f5"; }An img tag loads each icon as its own file: <img src="/assets/img/house.svg" alt="" width="24" height="24">. See SVG vs PNG for how the format choice changes these files.
How we tested
The page had a heading, a paragraph and 30 icons in a list. We ran every SVG through SVGO with the same settings and cut the font to the same 30 glyphs with subset-font.
- Server: local HTTP/2, Brotli level 11. Assets cached for a year, HTML revalidated with an ETag.
- Network and CPU: 1.6 Mbps down, 150 ms round trip and 4x CPU slowdown, set through Chrome DevTools Protocol.
- Runs: median of 5 for the 30-icon page, median of 3 for the 300-icon page and the full-set files.
- Icons visible: the time of the first screencast frame that matches the finished page.
The font's CSS sat inside the HTML. A separate stylesheet would add a request, so this setup favors the font.
Bytes and requests
Totals are for the HTML plus the assets. The woff2 file is already compressed, so it stays the same in both columns.
| Method | Gzip | Brotli | On the wire | Requests |
|---|---|---|---|---|
| Inline SVG | 2,180 | 1,818 | 1,932 | 1 |
| Sprite, 30 icons | 2,448 | 2,096 | 2,302 | 2 |
| Font subset, 30 icons | 6,865 | 6,593 | 6,790 | 2 |
| img tags | 7,208 | 6,082 | 7,745 | 31 |
| Full Lucide sprite | 94,950 | 75,253 | 75,496 | 2 |
| Full Lucide font | 313,094 | 312,822 | 313,195 | 2 |
"On the wire" is Chrome's own count and includes headers. Three results stand out.
The font is larger than the sprite, not smaller. The 30-icon font is 5,680 bytes and the sprite is 1,366 with Brotli. With 300 different icons, it was 51.5 KB against 13.2 KB. Lucide icons are thin strokes, and a font has to store each one as an expanded outline. We checked one icon set, so a set of filled shapes may land closer.
Full sets are the real cost. The full font is 55 times the size of the subset. The lucide-static notes warn against using its full sprite or font on web pages, and this is why.
Repeated inline markup compresses to almost nothing. Ten copies of the same 30 icons took the HTML from 11,331 to 105,588 bytes raw, but only from 1,818 to 1,832 with Brotli. The older advice that inline SVG makes the document huge is true for raw size and for parsing, not for transfer. With 300 different icons, inline is 11.8 KB with Brotli and the sprite plus its <use> markup is 15.1 KB.
The sprite wins once pages share it. Each further page costs 820 bytes with a sprite and 1,882 with inline.
| Pages viewed | Sprite | Inline |
|---|---|---|
| 1 | 2,302 | 1,932 |
| 2 | 3,122 | 3,814 |
| 10 | 9,682 | 18,870 |
Those are small numbers. A few kilobytes rarely decide this, and the sections below usually matter more.
Paint time
Text painted at about 210 ms for almost every method. The table shows when the icons were visible.
| Method | First visit | Same page again | Next page |
|---|---|---|---|
| Inline SVG | 207 ms | 206 ms | 208 ms |
| Sprite, 30 icons | 360 ms | 219 ms | 220 ms |
| Font subset | 381 ms | 219 ms | 225 ms |
| img tags | 584 ms | 311 ms | 307 ms |
| Full Lucide sprite | 971 ms | 477 ms | 519 ms |
| Full Lucide font | 1,938 ms | 230 ms | 236 ms |
Inline is the only method where icons never arrive after the text. The subset sprite and subset font tie.
Two rows break the usual advice that cached means free:
- Full sprite: first paint on a repeat visit was 476 ms, because Chrome still parses the whole document on every page. Cutting it to the icons you use is worth more than any cache header.
- img tags: first paint on a repeat visit was about 300 ms, with 30 cache reads ahead of it.
Preload did not help. It left icon timing about the same for both the font and the sprite. On the font it also delayed the first paint of text by about 110 ms (324 ms against 212 ms) in 5 of 5 runs. We did not trace the cause, and it may differ on your page, so measure before you add it.
With ten times the icons on the page (300 instances), the order stayed the same: inline 244 ms, sprite 393 ms, font 411 ms, img 601 ms. For very long grids, also read lazy loading SVGs.
When the asset is slow or fails
This is where the methods truly differ. We delayed the asset by 5 seconds and took screenshots, then made the request fail.
![]()
- Font, default and
swap: blank until the file arrives.font-display: swapgave no visible gain, because the fallback font has no drawing for these characters, and Chrome on Linux left the box empty. - Font,
optional: icons stayed blank for the whole visit, even after the file arrived. - Sprite and img: the same blank gap. A slow sprite is no better than a slow font, so this is not a font-only problem.
- Failed request: the sprite and font left an empty space, and img showed broken-image icons. Firefox showed a small hex-code box when we blocked the font.
- Inline SVG: fine in all three cases.
So if an icon is the only label on a button, use inline SVG for it or give it visible text.
Layout shift
Here the fix is the same for each method: give the icon a fixed size. We delayed the asset by 1 second and measured with Chrome's layout-shift API.
| Setup | Layout shift score |
|---|---|
| Inline SVG | 0 |
| Sprite with a size set | 0 |
| img with width and height | 0 |
| Font in a fixed-size box | 0 |
| Font with inline-block and line-height 1, no width | 0.0008 |
| Font with Lucide's stylesheet, inside a line of text | 0.0166 |
| img without width and height | 0.042 |
A sprite with no size and no CSS scored 0 but drew each icon at 300 by 150 px. Set the size even when the score looks fine.
DOM nodes
Sprites are often sold as keeping the DOM clean. That holds for what you see in DevTools, not for what Chrome keeps in memory.
| Method | Elements in the page | Chrome node count |
|---|---|---|
| Font subset | 102 | 169 |
| Inline SVG | 152 | 188 |
| img tags | 102 | 249 |
| Sprite, 30 icons | 132 | 363 |
| Full Lucide sprite | 132 | 22,853 |
Chrome's count includes the copies that <use> creates and the sprite document itself. At 300 instances, the sprite reached 2,712 nodes and inline 1,728.
Main-thread work tells the same story at 300 instances on a repeat visit: font 94 ms, inline 98 ms, sprite 187 ms, img 227 ms.
For a look at a different browser and a heavier page, Cloud Four's SVG icon stress test timed 1,000 icons in six browsers. It found external sprites strong in Safari and weak in Chrome and Edge, which fits our node count.
Color and forced colors
The old claim that sprites are limited to one color is wrong. CSS custom properties pass through <use>, so stroke="var(--accent, currentColor)" inside a symbol gave us a two-color icon. What page CSS cannot do is reach a single path inside the sprite.
| Control | Font | Sprite | Inline | img |
|---|---|---|---|---|
CSS color | Yes | Yes | Yes | No |
CSS stroke-width | No | Yes | Yes | No |
| Style one path from page CSS | No | No | Yes | No |
| Second color through a variable | No | Yes | Yes | No |
| Forced colors, dark theme | Follows | Follows | Follows | Invisible |
Two results need a warning:
Inherited font-weight changes font icons. Inside a bold button or heading, the browser fakes a bold version of the icon. It added 41% more ink in our test. Set font-weight: normal on the icon. SVG was not affected.
An img tag cannot follow forced colors. In the emulated dark theme, a black Lucide icon in an img tag was black on black: 0 visible pixels. The other three measured 21:1 contrast. For more, including mask and background icons, read our test of accessible SVG icons, which also covers labels and screen readers.
Cross-origin limits
We loaded each method from a different port. Chrome 156 and Firefox 158 gave the same results.
| Test | Result |
|---|---|
<use>, no CORS headers | Blocked |
<use>, with Access-Control-Allow-Origin | Blocked |
<use> with crossorigin="anonymous" | Blocked |
<use> with a data URL | Blocked |
| img tag | Works |
| Font, no CORS headers | Blocked |
Font, with Access-Control-Allow-Origin | Works |
Fetch the sprite with CORS, add it to the page, then <use href="#house"> | Works |
CORS headers do not help a sprite. MDN's page on <use> says there is no defined way to set a cross-origin policy for it. So serve the sprite from the same origin as the page. If it must live on a CDN domain, use the fetch workaround or proxy the file through your own domain, and note that the fetch needs JavaScript.
Sharpness
Inline SVG and img tags were pixel identical. The font was not.
![]()
Chrome draws font glyphs as text, with subpixel antialiasing. On this machine the 16 px font icon had 146 tinted edge pixels and SVG had none. The icons are not blurry, and on a normal screen you may not notice. A 2x screen cut the difference between font and SVG from 9.6% of pixels to 5.4% at 16 px. We did not check macOS or Windows, which smooth text differently.
Licensing and embedding
The delivery method can change what the licence asks of you. Lucide uses the ISC licence, which allows copying and changing the files, so a subset or sprite is fine if you keep the notice.
Commercial symbol and dingbat fonts are often different. Many sell desktop, web and app use separately, and some restrict subsetting or converting the font. Read the licence before you subset or convert a paid font. We did not review individual licences for this post.
Which one to use
| Feature | Inline SVG | Subset sprite | Font subset | img tags |
|---|---|---|---|---|
| Best for | Few icons, key UI | Many pages, same icons | Existing systems | Logos, fixed art |
| Slow asset | No gap | Blank gap | Blank gap | Blank gap |
| Cross-origin | Not needed | Same origin only | Needs CORS | Works |
| Page CSS | Full | Most | Color only | None |
| Forced colors | Follows | Follows | Follows | Can vanish |
A sensible default mixes them: inline SVG for the few icons in your header and main buttons, and a subset sprite for the rest of the site. Run files through the SVG optimizer first.
If you use React or Vue, a component usually renders as inline SVG in the output, plus its share of the JavaScript bundle. For choosing a set in that setup, see our shadcn/ui icon comparison.
What we did not test
- One machine, one network profile. The server was local with a simulated network, on a machine also doing other work. Use the order of results, not the exact milliseconds.
- Safari. Not tested at all. Firefox was used only for the cross-origin and blocked-font checks.
- Real phones and real networks. CPU slowdown and network limits were simulated.
- React or Vue components. No bundle costs were measured.
- Color fonts and other icon sets. The size results are for Lucide only.
- Screen readers. Not tested here. Our accessibility post above covers this.
Are icon fonts obsolete?
What is an SVG sprite?
Is inline SVG bad for performance?
Can I load an SVG sprite from a CDN on another domain?
Should I use img tags for icons?
Which method causes the least layout shift?
Related posts