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.
On this page
- What is the difference between SVG and PNG?
- Which file is smaller?
- Where does PNG become smaller?
- How fast do 1,000 icons load?
- A trap when you inline detailed icons
- How sharp is each one on a real screen?
- What can each format do?
- Is SVG safe?
- Where SVG is not accepted
- How to choose
- What we did not test
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:
| SVG | PNG | |
|---|---|---|
| Stored as | Shapes, in text | Pixels, in binary |
| Scaling | Sharp at any size | Soft when enlarged |
| File size grows with | Shape detail | Pixel count |
| Color from CSS | Inline SVG, yes | CSS mask only |
| Best for | Icons, logos, line art | Detailed small images, store icons |
| Can contain scripts | Yes | No |
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:
| Set | Raw SVG | SVGO | SVGO + gzip | SVGO + Brotli |
|---|---|---|---|---|
| Lucide | 464 | 363 | 245 | 209 |
| Flag Icons | 734 | 684 | 321 | 287 |
| Twemoji | 2,016 | 1,932 | 834 | 768 |
| Fluent Emoji | 35,965 | 34,881 | 5,267 | 4,460 |
| 20 largest flags | 36,625 | 36,079 | 12,864 | 11,187 |
| Set | PNG 24 px | PNG 48 px | PNG 96 px | PNG 192 px |
|---|---|---|---|---|
| Lucide | 359 | 629 | 1,186 | 2,123 |
| Flag Icons | 294 | 572 | 1,111 | 2,045 |
| Twemoji | 785 | 1,610 | 3,118 | 6,376 |
| Fluent Emoji | 1,116 | 2,768 | 7,421 | 20,986 |
| 20 largest flags | 540 | 1,311 | 3,428 | 9,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:
| Set | 24 px | 48 px | 96 px | 192 px | 512 px |
|---|---|---|---|---|---|
| Lucide | 6% | 4% | 0% | 0% | 0% |
| Twemoji | 52% | 10% | 0% | 0% | 0% |
| Flag Icons | 68% | 46% | 28% | 12% | 0% |
| Fluent Emoji | 94% | 68% | 6% | 0% | 0% |
| 20 largest flags | 100% | 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:
| Page | Load event | Main thread | Transfer |
|---|---|---|---|
| 100 Lucide, SVG in img | 103 ms | 106 ms | 23 KB |
| 100 Lucide, inline SVG | 11 ms | 12 ms | 6 KB |
| 100 Lucide, external sprite | 18 ms | 19 ms | 6 KB |
| 100 Lucide, PNG in img | 60 ms | 35 ms | 49 KB |
| 1,000 Lucide, SVG in img | 4,603 ms | 4,570 ms | 224 KB |
| 1,000 Lucide, inline SVG | 28 ms | 38 ms | 41 KB |
| 1,000 Lucide, external sprite | 90 ms | 87 ms | 42 KB |
| 1,000 Lucide, PNG in img | 476 ms | 269 ms | 475 KB |
| 1,000 Fluent, SVG in img | 7,899 ms | 8,223 ms | 3.9 MB |
| 1,000 Fluent, inline SVG | 3,031 ms | 3,122 ms | 2.2 MB |
| 1,000 Fluent, PNG in img | 476 ms | 238 ms | 6.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:

The numbers agree. This is the mean pixel difference from the SVG render for 20 Lucide icons, on a scale of 0 to 100%:
| Screen | PNG 24 px | PNG 48 px | PNG 72 px |
|---|---|---|---|
| 1x | 0% | 1.04% | 2.91% |
| 2x | 7.72% | 0% | 0.70% |
| 3x | 7.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:
| Method | Took the red? |
|---|---|
| Inline SVG | Yes |
| SVG in img | No |
| PNG in img | No |
| PNG as a CSS mask | Yes |
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-schemerule 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
viewBoxin an<img>grew to 784 by 784 px in an 800 px wide window. Addwidthandheight.
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:
| Where | SVG? | Use this |
|---|---|---|
| Browser favicon | Chrome 80, Firefox 41, Safari 26 | SVG plus a fallback |
| Google Search favicon | Not in its list | PNG or ICO |
| Google Images | Yes | Either |
| Apple touch icon | No | PNG |
| App Store icon | Only inside Icon Composer | 1024 px PNG |
| Google Play icon | No | 512 px, 32-bit PNG |
| Chrome extension icon | No | PNG |
| Web app manifest | Chromium, yes | 192 and 512 px PNG too |
| Gmail | Converted to PNG | PNG at 2x |
| Outlook 2019, Apple Mail, Yahoo | Listed as yes | PNG at 2x |
| Outlook 2016 and older on Windows | Listed as no | PNG 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 case | Use |
|---|---|
| UI icons, under about 100 on a page | SVG, inline or in img |
| Icon grid with hundreds of icons | Inline SVG or a sprite |
| Detailed icons shown small, in large numbers | PNG, WebP or AVIF |
| Icon that must follow text color | Inline SVG |
| Logo | SVG, plus PNG for email and social |
| Favicon | SVG, ICO and Apple touch PNG |
| App store or extension icon | PNG |
| PNG at 2x | |
| User uploads | PNG, 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?
Is SVG smaller than PNG?
Does SVG load faster than PNG?
Can I use SVG as a favicon?
Should I use SVG in email?
What about JPG?
Related posts