PNG vs SVG for Web: File Size, Performance, and When to Use Each
PNG is a bitmap: every pixel gets stored, leading to large files. SVG is a text format: paths are mathematical, files are tiny. For logos and icons, SVG wins. For photos and complex gradients, PNG often wins on file size.
November 21, 2026 · 9 min read
PNG vs SVG web performance comes down to two storage models. PNG is a bitmap: it records the color of every pixel in a deflate-compressed grid, so file size scales with dimensions and detail. SVG is a text format based on XML: it records shapes as math — lines, curves, circles — so a logo built from 20 paths stays a few kilobytes whether it renders at 32 pixels or 3,000. For logos, icons, and UI graphics, SVG wins on file size, sharpness, and speed. For photographs and soft painterly gradients, PNG usually wins, because describing millions of unique colors as vector paths costs far more bytes than storing the pixels.
How PNG and SVG Store Images Differently
A PNG file stores a rectangular pixel grid. Each pixel carries a color (8 bits per channel in PNG-24) plus an optional alpha transparency channel (PNG-32). The grid is compressed with deflate — the same algorithm as ZIP — which predicts each row from the row above and Huffman-codes the result. That works beautifully for flat color regions and hard edges, and poorly for noise and photographic gradients. A 512×512 PNG-24 always contains 262,144 pixels; no encoder can shrink that count, only compress it better. PNG-8 cuts size further by quantizing to a 256-color palette, typically at 60–80% of PNG-24's bytes for flat artwork.
An SVG file stores instructions instead of samples. The text <circle cx='50' cy='50' r='40' fill='#e8412a'/> is about 45 bytes and describes a circle at any resolution the browser needs. Curves are cubic Bézier paths defined by control points. Nothing is stored per pixel — the browser's rendering engine rasterizes the description at display resolution on the fly. SVG 1.1 has been a W3C Recommendation since 2003 and SVG2 is the current specification. Because SVG is plain text, it also supports CSS styling, DOM scripting, and animation — none of which PNG can do.
Two practical consequences follow. First, PNG has a fixed native resolution: scaling it beyond that resolution shows pixel blocks. Second, SVG size depends on path complexity, not display size: a hand-built 12-path logo might be 1.5 KB, while an auto-traced photograph with 40,000 nodes can exceed 2 MB — larger than the PNG it came from.
PNG vs SVG File Size Comparison: Real Numbers
File size comparisons only mean something with concrete assets. These are typical measured sizes for the same artwork saved in each format, before server compression:
| Asset | SVG | PNG | Winner |
|---|---|---|---|
| 24×24 UI icon, 2 colors | 0.3–0.8 KB | 0.9–1.5 KB (PNG-24) | SVG |
| Company logo, 3 colors, ~20 paths | 2–5 KB | 18–40 KB at 600×200 | SVG |
| Flat illustration, 512×512, ~300 paths | 12–45 KB | 120–300 KB | SVG |
| Auto-traced photo, 10,000+ nodes | 400 KB–2 MB | 150–400 KB | PNG |
| Photograph, 1920×1280 | Not viable | 2–5 MB (WebP/JPEG: 200–500 KB) | Raster |
Is SVG always smaller than PNG?
No — SVG is smaller only when the artwork is geometrically simple: few paths, flat fills, clean curves. Once an image contains thousands of unique colors, or an auto-trace produces tens of thousands of nodes, the XML describing those paths exceeds the deflated pixel grid. The crossover typically happens at a few thousand path nodes for photographic content. The rule of thumb: if the design was drawn as vectors, ship vectors; if it was captured as pixels, keep pixels.
How much does server compression help each format?
Compression helps SVG enormously and PNG almost not at all. SVG is text, so Brotli or gzip shrinks it a further 60–80%: a 12 KB SVG typically arrives as 2–4 KB. PNG is already deflated internally, so server compression saves under 1–2% — sometimes nothing. Minification matters too: running SVG through SVGO with 2–3 decimal coordinate precision commonly removes 40–70% of the bytes before compression by stripping editor metadata, empty groups, comments, and hidden layers that Illustrator and Inkscape leave behind.
How Each Format Affects Rendering and Load Performance
Download size is only half of web performance optimization; the browser still has to paint the image. PNG decodes once into a bitmap that the GPU composites cheaply. Decode cost grows with pixel count — a 4,000-pixel-wide PNG can take 50–150 ms to decode on mid-range mobile hardware, and if it is the Largest Contentful Paint element, that delay shows up directly in Core Web Vitals.
Do SVG files slow down page rendering?
Simple SVGs do not — anything under roughly 100 elements paints in a few milliseconds and the browser caches the rasterized layer. Expensive SVG does: Gaussian blur filters, stacked clip-paths, and files with tens of thousands of path nodes recompute on resize and can jank during animation. An auto-traced 2 MB SVG used as a hero image is a real performance problem, not because it is SVG, but because it is a bad SVG. Keep vector art node-lean and the format is the fastest option on the page.
Placement also changes the cost model. Inline SVG (pasted into the HTML) adds DOM nodes to the main document, which grows style and layout work slightly, but removes one HTTP request. An external SVG in an <img> tag renders in an isolated context, is cached independently across pages, and cannot run scripts. One performance trick only inline SVG can do: interactive states with zero extra requests — a CSS :hover rule that changes fill costs no bytes, where the PNG equivalent needs a second preloaded image or a sprite.
Scaling, DPI, and Retina Displays
On a standard display one CSS pixel maps to one device pixel; on a 2x Retina screen it maps to four, and on 3x phones, nine. A PNG sized for 1x looks soft everywhere else, so teams ship 2x and 3x cuts — doubling or tripling total download weight — and wire them together with srcset. A 200×60 logo needs 200×60, 400×120, and 600×180 PNG variants, and the browser picks per device density. Every new breakpoint or dark-mode variant multiplies the set again.
SVG skips all of it. One 3 KB file renders razor-sharp at every density and every layout size, from a 16 px favicon to a full-width hero. That is the strongest vector vs raster argument in responsive design: you maintain one asset instead of three to five, and high-DPI users download less instead of more. SVG also survives zoom — a user at 400% browser zoom sees crisp edges, while PNG turns to blocks.
When to Use PNG and When to Use SVG
| Use case | Format | Why |
|---|---|---|
| Logo, wordmark | SVG | Smallest size, infinite scale, CSS-recolorable for dark mode |
| UI icons | SVG symbol sprite | One cached file serves the whole icon set |
| Photographs | PNG only if lossless matters; else WebP/JPEG | Vectors cannot describe photo data efficiently |
| Screenshots with text | PNG | Lossless keeps text crisp; JPEG adds ringing artifacts |
| Charts, data visualization | SVG | Crisp lines, accessible DOM nodes, animatable series |
| Simple animation | SVG + CSS, or APNG | SVG animates with no extra requests; APNG animates in an img tag |
| Transparency needs | PNG-24/32 or SVG | Both carry full 8-bit alpha; GIF does not |
| Email images, ad networks | PNG | Most email clients and ad servers block or break SVG |
Should I use SVG or PNG for my website logo?
Use SVG for your website logo in almost every case. A typical 3-color logo is 2–5 KB as SVG versus 18–40 KB as a 600×200 PNG, it stays sharp on 2x and 3x screens without srcset variants, and CSS can recolor it for dark mode at zero extra bytes. Keep one PNG (or two) as a fallback for contexts that do not render SVG — email clients, some social platforms, and legacy ad networks — and use SVG everywhere the browser is in your control.
How to Convert Between PNG and SVG Correctly
SVG → PNG is pure rasterization: choose the output pixel dimensions (or DPI) and render. Quality cannot be lost in this direction — you only need a resolution high enough for the destination, e.g. 1200×630 for social share cards. PNG → SVG is different: it requires tracing, an algorithm that walks pixel regions and fits Bézier curves around them. Results depend entirely on the source. Flat, high-contrast artwork traces cleanly at 2–8 colors; photographs and anti-aliased gradients produce node-heavy mush that renders slower than the PNG it replaced. The image tracing guide covers thresholds, color counts, and node simplification in depth.
Practical tracing settings: quantize the source to the fewest colors the design actually uses, enable corner detection for logos with hard angles, then simplify paths to remove stray nodes before export. Our PNG to SVG converter handles the tracing step and exports clean, minified SVG ready for production; the SVG to PNG converter goes the other way at any resolution you need for app stores, social cards, or email fallbacks.
Web Performance Optimization Checklist for Images
- Ship SVG for every drawn asset — logos, icons, illustrations, charts — minified with SVGO and served with Brotli.
- Inline critical SVGs that belong to the LCP hero so no second request is needed; load non-critical SVGs externally so the browser caches them across pages.
- Use PNG for pixels: screenshots, artwork needing lossless quality, and email. Prefer WebP or AVIF for photographs where browser support allows.
- Set width and height (or viewBox) on every image so the browser reserves layout space and avoids cumulative layout shift.
- Lazy-load below-the-fold images with
loading='lazy'— but never the LCP image. - Audit in DevTools: the Network panel shows transferred versus resource size; if an SVG is not shrinking after compression, your host is not compressing it.
- Mark up for accessibility: an SVG used as an image carries
role='img'with a<title>; a decorative one carriesaria-hidden='true'; a PNG needs a sensible alt attribute.
The deeper background on how vector formats differ from each other lives in vector file formats explained. Whichever format you choose, the performance win comes from matching the storage model to the content: math for drawn shapes, pixels for captured ones — and never shipping a 2 MB traced SVG where a 3 KB hand-built one does the job.
Frequently asked questions
Is SVG faster than PNG for websites?
SVG is faster for logos, icons, and illustrations because files are smaller and Brotli compresses text another 60–80%. A 3-color logo is typically 2–5 KB as SVG versus 18–40 KB as PNG, and SVG needs no 2x/3x retina variants. PNG decodes faster for photographs, where vector descriptions would be many times larger than the pixels themselves. Match the format to the content: vectors for drawn art, rasters for photos.
When should I use PNG instead of SVG?
Use PNG for photographs, screenshots, and any image with thousands of unique colors or soft gradients. Vector formats describe images as paths, and photographic detail produces tens of thousands of nodes — an SVG trace of a photo can exceed 2 MB while the PNG stays under 400 KB. PNG is also the safe choice for email clients and ad networks, which frequently block or break SVG rendering entirely.
How much smaller is SVG than PNG?
For flat design assets SVG is typically 5–20x smaller. A 24 px two-color icon measures about 0.5 KB as SVG versus 1.2 KB as PNG-24; a 600×200 company logo runs 2–5 KB as SVG versus 18–40 KB as PNG. The gap widens after Brotli compression, which shrinks text-based SVG a further 60–80% but does almost nothing for already-deflated PNG. Auto-traced photos reverse the ratio in PNG's favor.
Does SVG hurt SEO or accessibility?
No — SVG can help both, if you mark it up correctly. Search engines index inline SVG text content, and an SVG with role='img' plus a title element gives screen readers the same information as an alt attribute on a PNG. Decorative SVG should carry aria-hidden='true'. The real SEO risk is performance-related: an unoptimized multi-megabyte traced SVG slows Largest Contentful Paint and hurts Core Web Vitals scores.
Can any PNG be converted to SVG without quality loss?
Any PNG can be converted, but only flat, geometric artwork converts well. Tracing algorithms fit Bézier curves around regions of similar color, so logos and icons with 2–8 colors produce clean, editable vectors. Photographs and anti-aliased gradients trace into thousands of nodes, yielding SVG files larger than the original PNG and slow to render. Quantize colors and simplify paths before exporting to get usable SVG from raster sources.
Sources
Convert files for this workflow
Try it on your own file
Drop in an image or an SVG and see the result before you pay. No signup is required to preview.