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.

Amit Yadav
15 min read
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.

MethodGzipBrotliOn the wireRequests
Inline SVG2,1801,8181,9321
Sprite, 30 icons2,4482,0962,3022
Font subset, 30 icons6,8656,5936,7902
img tags7,2086,0827,74531
Full Lucide sprite94,95075,25375,4962
Full Lucide font313,094312,822313,1952

"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 viewedSpriteInline
12,3021,932
23,1223,814
109,68218,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.

MethodFirst visitSame page againNext page
Inline SVG207 ms206 ms208 ms
Sprite, 30 icons360 ms219 ms220 ms
Font subset381 ms219 ms225 ms
img tags584 ms311 ms307 ms
Full Lucide sprite971 ms477 ms519 ms
Full Lucide font1,938 ms230 ms236 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.

Six rows of test results for icon fonts, sprites, img tags and inline SVG with a delayed asset, an arrived asset and a failed request. Only inline SVG shows icons in all three columns.

  • Font, default and swap: blank until the file arrives. font-display: swap gave 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.

SetupLayout shift score
Inline SVG0
Sprite with a size set0
img with width and height0
Font in a fixed-size box0
Font with inline-block and line-height 1, no width0.0008
Font with Lucide's stylesheet, inside a line of text0.0166
img without width and height0.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.

MethodElements in the pageChrome node count
Font subset102169
Inline SVG152188
img tags102249
Sprite, 30 icons132363
Full Lucide sprite13222,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.

ControlFontSpriteInlineimg
CSS colorYesYesYesNo
CSS stroke-widthNoYesYesNo
Style one path from page CSSNoNoYesNo
Second color through a variableNoYesYesNo
Forced colors, dark themeFollowsFollowsFollowsInvisible

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.

TestResult
<use>, no CORS headersBlocked
<use>, with Access-Control-Allow-OriginBlocked
<use> with crossorigin="anonymous"Blocked
<use> with a data URLBlocked
img tagWorks
Font, no CORS headersBlocked
Font, with Access-Control-Allow-OriginWorks
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.

The settings icon at 16 and 24 pixels, enlarged ten times. The icon font has orange and blue edges, while inline SVG and img tag renders are grey.

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

FeatureInline SVGSubset spriteFont subsetimg tags
Best forFew icons, key UIMany pages, same iconsExisting systemsLogos, fixed art
Slow assetNo gapBlank gapBlank gapBlank gap
Cross-originNot neededSame origin onlyNeeds CORSWorks
Page CSSFullMostColor onlyNone
Forced colorsFollowsFollowsFollowsCan vanish
Results from our 30-icon test in Chrome 156.

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?
Not obsolete, but rarely the best choice for new work. In our test a subset font was as fast as a subset sprite, but it was about four times larger, offered less CSS control, and changed shape under inherited bold text. Keep one if a system already depends on it.
What is an SVG sprite?
One SVG file holding many icons as symbol elements, each with an id. A page draws an icon by pointing a use element at that id, so the browser downloads and caches the file once.
Is inline SVG bad for performance?
Not at small and medium counts. It was the fastest method for icons in our test and the smallest on a single page. Its cost is that every page sends the icons again, about 1,050 bytes more per page than a sprite with 30 icons.
Can I load an SVG sprite from a CDN on another domain?
Not directly. Chrome and Firefox blocked it even with CORS headers. Serve it from your own origin, or fetch it with CORS and add it to the page with JavaScript.
Should I use img tags for icons?
Use them for logos and fixed artwork. They cannot take color from CSS, they made the most requests, and a black icon vanished in the forced colors dark theme test.
Which method causes the least layout shift?
All of them scored 0 once the icon had a fixed size. The worst result was an img tag with no width and height, at about 0.042.

Related posts

Share this post