SVG vs PNG: Difference, File Size Test, and When to Use Each

SVG scales and takes CSS color. PNG is a fixed grid of pixels. We measured 216 icons at eight sizes and timed 1,000 icons in Chrome to find where each one wins.

Amit Yadav
16 min read
On this page

Use SVG for website icons and logos, because one file stays sharp at every size and can take its color from CSS. Use PNG where SVG is not accepted, such as app store icons and Chrome extensions, and for very detailed icons shown small.

We tested this on 2026-11-05 in Chrome 156 with four real icon sets. Every number below comes from that test, and the end of this post lists what we did not test.

Quick answer

  • Simple icons: SVG wins. A Lucide icon is 209 bytes with Brotli. The same icon as a 48 px PNG is 629 bytes.
  • Detailed icons: PNG can win when small. A Fluent Emoji SVG is 4,460 bytes with Brotli. Its 24 px PNG is 1,116 bytes.
  • Speed: 1,000 different icons as separate SVG files took 4.6 s to load in Chrome. As PNG, 0.48 s. Inline SVG, 0.03 s. With 100 icons, the gap is 103 ms against 60 ms and 11 ms.
  • Sharpness: PNG needs one file per screen density. A 24 px PNG on a 2x screen is visibly soft.
  • PNG only: Google Play, Chrome extension icons and Apple touch icons. Google Search does not list SVG as a favicon format, so keep a PNG or ICO as well.

What is the difference between SVG and PNG?

SVG is a vector format: a text file of shapes that the browser draws at whatever size you ask for. PNG is a raster format: a fixed grid of colored pixels with lossless compression and transparency.

That one difference causes most of the others:

SVGPNG
Stored asShapes, in textPixels, in binary
ScalingSharp at any sizeSoft when enlarged
File size grows withShape detailPixel count
Color from CSSInline SVG, yesCSS mask only
Best forIcons, logos, line artDetailed small images, store icons
Can contain scriptsYesNo

Neither format is right for photos. Use JPEG, WebP or AVIF for those.

Which file is smaller?

We took 50 evenly spaced icons from each of four sets: Lucide (line icons), Twemoji (flat emoji), Flag Icons and Fluent Emoji (detailed, with gradients). We added the 20 largest flags as a worst case.

SVGs were cleaned with SVGO 4.1.0 in multipass mode. PNGs were rendered in Chrome, then compressed without loss by oxipng at level 4. These are median bytes per icon:

SetRaw SVGSVGOSVGO + gzipSVGO + Brotli
Lucide464363245209
Flag Icons734684321287
Twemoji2,0161,932834768
Fluent Emoji35,96534,8815,2674,460
20 largest flags36,62536,07912,86411,187
SetPNG 24 pxPNG 48 pxPNG 96 pxPNG 192 px
Lucide3596291,1862,123
Flag Icons2945721,1112,045
Twemoji7851,6103,1186,376
Fluent Emoji1,1162,7687,42120,986
20 largest flags5401,3113,4289,547

Two things stand out. Brotli does more than SVGO here: these sets are already clean, so SVGO saved only 2% to 20%, while Brotli cut the Fluent Emoji files by 87%. An SVG exported from a design tool has more to remove, and we did not test those. Compression needs the server to send it, so check that your host compresses image/svg+xml.

Run your own files through the SVG optimizer first. The SVGO settings guide covers what each option removes.

Where does PNG become smaller?

It depends on how much detail the icon has and how many pixels you need. This table shows the share of icons in each set where a lossless PNG was smaller than the Brotli SVG:

Set24 px48 px96 px192 px512 px
Lucide6%4%0%0%0%
Twemoji52%10%0%0%0%
Flag Icons68%46%28%12%0%
Fluent Emoji94%68%6%0%0%
20 largest flags100%100%100%65%0%

Remember that a 24 px icon on a 2x phone needs the 48 px PNG. Pooled across the sample, a rough guide by Brotli SVG size:

  • Under 1 KB: keep SVG. PNG can win at 24 px and rarely above that.
  • 1 to 2 KB: PNG almost always wins at 24 px and about a quarter of the time at 48 px.
  • 2 to 5 KB: PNG wins at 32 px and usually at 48 px.
  • 5 to 20 KB: PNG wins up to 72 px and a bit over half the time at 96 px.
  • Over 20 KB: PNG wins up to 192 px. Only flags reached this size.

At 512 px, no PNG beat its SVG. The worst case was the flag of Serbia: 181 KB raw and 41 KB with Brotli, against 5.5 KB as a 96 px PNG.

If you do need pixels on the web, WebP and AVIF go further. A Fluent Emoji at 96 px was 7,421 bytes as lossless PNG, 2,077 bytes as WebP quality 85 and 1,985 bytes as AVIF quality 60. Both of those formats lose some detail, so compare them by eye.

How fast do 1,000 icons load?

File size is only part of the cost. We built test pages with the same icons in four ways, served them over local HTTP/2 with Brotli, and loaded each one cold in Chrome 156 at 2x density. Times are the median of 5 runs, without tracing:

PageLoad eventMain threadTransfer
100 Lucide, SVG in img103 ms106 ms23 KB
100 Lucide, inline SVG11 ms12 ms6 KB
100 Lucide, external sprite18 ms19 ms6 KB
100 Lucide, PNG in img60 ms35 ms49 KB
1,000 Lucide, SVG in img4,603 ms4,570 ms224 KB
1,000 Lucide, inline SVG28 ms38 ms41 KB
1,000 Lucide, external sprite90 ms87 ms42 KB
1,000 Lucide, PNG in img476 ms269 ms475 KB
1,000 Fluent, SVG in img7,899 ms8,223 ms3.9 MB
1,000 Fluent, inline SVG3,031 ms3,122 ms2.2 MB
1,000 Fluent, PNG in img476 ms238 ms6.9 MB

What this shows:

  • Separate SVG files get slower quickly. Ten times the icons took 45 times as long. We measured that main thread time but did not find its exact cause in Chrome. The 1,000 Lucide load also varied the most, from 2.8 s to 4.8 s.
  • The cost is per different file, not per image. A page with 1,000 <img> tags pointing at 20 Lucide files loaded in 45 ms. That run used tracing, which adds time, so the true gap is larger.
  • Inline SVG is the fastest for simple icons, and it compresses as one document. Detailed icons change that: 1,000 Fluent Emoji added about 322,000 DOM nodes.
  • PNG main thread time hides some work. A traced run showed about 510 ms of decode tasks on other threads for the 1,000 Lucide PNG page, against none for SVG.

Do not read this as "SVG is slow". Most pages have far fewer than 1,000 icons, and at 100 the worst result was 103 ms. With 4x CPU throttling, the 100 icon page took 405 ms as SVG in img, 154 ms as PNG, 70 ms as a sprite and 42 ms inline. On local HTTP/2, the network costs almost nothing, so the 6.9 MB Fluent PNG page would look much worse on a real connection.

For an icon grid, use inline SVG or a sprite. The SVG sprite maker builds the file, and icon fonts vs sprites vs inline SVG covers the trade-offs.

A trap when you inline detailed icons

SVGO shortens gradient IDs to a, b and c. In a separate file that is safe. When you inline many icons in one page, the IDs clash and icons take each other's gradients.

We inlined 50 Fluent Emoji cleaned with default SVGO: 49 of them rendered differently from the same icon on its own. With a unique prefix per icon, none did:

import { optimize } from 'svgo';

const { data } = optimize(svg, {
  multipass: true,
  plugins: [
    { name: 'preset-default' },
    { name: 'prefixIds', params: { prefix: 'icon1' } },
  ],
});

How sharp is each one on a real screen?

We rendered one line icon and one color icon at 24 CSS px at 1x, 2x and 3x density. These are real Chrome screenshots, enlarged with no smoothing so you can see each pixel:

Grid of Chrome screenshots comparing an SVG with 24, 48 and 72 px PNGs of a settings icon and a rocket emoji at 1x, 2x and 3x density. The 24 px PNG is blurry at 2x and 3x, and the 48 px PNG is slightly soft at 3x.

The numbers agree. This is the mean pixel difference from the SVG render for 20 Lucide icons, on a scale of 0 to 100%:

ScreenPNG 24 pxPNG 48 pxPNG 72 px
1x0%1.04%2.91%
2x7.72%0%0.70%
3x7.68%3.29%0%

A PNG that matches the density is identical to the SVG. A PNG that is too small is soft, and one that is too large is not identical either, because the browser has to shrink it. Fluent Emoji showed the same pattern with smaller differences (3.53% for 24 px at 2x), since soft gradients hide blur.

To serve PNGs correctly, give the browser all three files. Chrome picked 24 px at 1x, 48 px at 1.5x and 2x, and 72 px at 3x:

<img src="search-24.png"
     srcset="search-24.png 1x, search-48.png 2x, search-72.png 3x"
     width="24" height="24" alt="Search">

The SVG to PNG converter exports one size at a time, in your browser, so run it once per density. This is also where the file count adds up: 50 Lucide icons are 50 SVG files totaling 10.7 KB with Brotli, or 150 PNG files totaling 110 KB. Each visitor downloads only one density, though, which is 36 KB on a 2x screen.

What can each format do?

We ran each of these in Chrome 156, inside a parent with color: red, using a black Lucide icon:

MethodTook the red?
Inline SVGYes
SVG in imgNo
PNG in imgNo
PNG as a CSS maskYes

So a PNG can follow the text color, if you use its alpha channel as a mask. This works with one color only:

.icon {
  width: 24px;
  height: 24px;
  background: currentColor;
  mask: url(search-48.png) center / contain no-repeat;
}

For more ways to do this, see how to change SVG icon color with CSS. Two more results from the same test:

  • Dark mode works inside an SVG file. A prefers-color-scheme rule in the SVG's own style block switched correctly, even in <img>. A PNG cannot do this.
  • Set a size. An SVG with only a viewBox in an <img> grew to 784 by 784 px in an 800 px wide window. Add width and height.

An <img> of either format needs alt. Inline SVG needs its own label, covered in accessible SVG icons.

Is SVG safe?

SVG can hold scripts, and PNG cannot. In our test, a script inside an SVG did not run when the file was loaded with <img>. It did run when the file was opened directly, and it could write to that site's localStorage. It also ran when the markup was part of the page's HTML.

So treat an SVG that users upload as code. Sanitize it, or serve it from a separate domain, and do not paste it inline. A file from a source you trust is a lower risk. PNG is the simple choice if you accept uploads and do not want to handle this.

Where SVG is not accepted

We read these official pages on 2026-11-05:

WhereSVG?Use this
Browser faviconChrome 80, Firefox 41, Safari 26SVG plus a fallback
Google Search faviconNot in its listPNG or ICO
Google ImagesYesEither
Apple touch iconNoPNG
App Store iconOnly inside Icon Composer1024 px PNG
Google Play iconNo512 px, 32-bit PNG
Chrome extension iconNoPNG
Web app manifestChromium, yes192 and 512 px PNG too
GmailConverted to PNGPNG at 2x
Outlook 2019, Apple Mail, YahooListed as yesPNG at 2x
Outlook 2016 and older on WindowsListed as noPNG at 2x

Favicons. Google's list reads "BMP, GIF, ICO, PNG, JPEG, PPM, and TIFF", so an SVG-only favicon is a risk in search results. This markup covers browsers, search and iOS:

<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">

Chrome 156 asked for the SVG first, then the ICO when our test server returned 404 for the SVG. The favicon generator makes the full set, and the favicon sizes guide explains each file.

Email. Can I Email lists wide support, but many of its entries are old and its Gmail row says the image "is rendered but rasterized in PNG". We did not send test mail. PNG is the safe choice, since one failure means a broken image in someone's inbox. The SVG in email guide has the table by client.

Social previews. The Open Graph spec does not limit image formats. Meta's guide gives sizes, and the section we read named no formats. We could not read X's card docs. We did not test any scraper, so use a 1200 by 630 PNG or JPEG.

Android apps. Android Studio imports SVG as a VectorDrawable. Not every SVG feature converts, and Google recommends a limit of 200 by 200 dp.

How to choose

Your caseUse
UI icons, under about 100 on a pageSVG, inline or in img
Icon grid with hundreds of iconsInline SVG or a sprite
Detailed icons shown small, in large numbersPNG, WebP or AVIF
Icon that must follow text colorInline SVG
LogoSVG, plus PNG for email and social
FaviconSVG, ICO and Apple touch PNG
App store or extension iconPNG
EmailPNG at 2x
User uploadsPNG, or sanitize the SVG

What we did not test

  • Browsers: Chrome 156 only, in headless mode. No Firefox, Safari, or real phones. The 4x throttle is a simulation.
  • Machine: AMD Ryzen 5 5600X on Linux, a shared machine with other work running. Treat the speeds as ratios, not as what your users get.
  • Network: local HTTP/2 with no delay. A real connection adds time per request and per byte.
  • Sample: 50 icons per set, evenly spaced by name, plus the 20 largest flags, and 20 icons per set for the sharpness numbers. Package versions: lucide-static 1.68.0, flag-icons 7.6.0, @twemoji/svg 15.0.0, @iconify-json/fluent-emoji 1.2.7, sharp 0.35.5. The 1,000 Fluent page used 48 CSS px, so part of it sat below the fold. PNGs on the speed pages used oxipng level 2.
  • Support table: read from official pages, not tested. We sent no email and uploaded nothing to any store.
Is SVG better than PNG?
For website icons and logos, usually yes. It stays sharp at any size and a simple icon is smaller. PNG is better where SVG is not accepted and for detailed icons shown small.
Is SVG smaller than PNG?
For simple icons, yes. A median Lucide icon was 209 bytes as SVG with Brotli and 629 bytes as a 48 px PNG. For detailed icons at small sizes, PNG is often smaller: 94% of Fluent Emoji were smaller as 24 px PNG.
Does SVG load faster than PNG?
It depends on how you use it. With 1,000 different icons, inline SVG took 28 ms and PNG took 476 ms, but separate SVG files took 4.6 s. With 100 icons, separate SVG files took 103 ms.
Can I use SVG as a favicon?
Yes in current browsers, including Safari from version 26. Google Search does not list SVG as a favicon format, so also provide an ICO or PNG.
Should I use SVG in email?
Use PNG. Can I Email reports that Gmail converts SVG to PNG, and support elsewhere varies. We did not send test mail.
What about JPG?
Use JPG, WebP or AVIF for photos. JPG has no transparency and blurs the hard edges that icons have, so it is a poor choice for icons.

Related posts

Share this post