ICON OOP
Icons & Logos
Guide

SVG vs PNG: which one, and why

The usual answer is "SVG for icons, PNG for photos", which is true and not very useful. The interesting cases are the ones in between, and they turn on how each format actually stores an image.

HomeGuidesSVG vs PNG

SVG and PNG solve the same problem in fundamentally different ways, and every practical difference between them follows from that one distinction.

PNG stores pixels. A grid of colour values, one per pixel. The file describes exactly what to display and the display shows it.

SVG stores instructions. A text file of shapes, coordinates and styles. The browser reads them and draws the image fresh at whatever size it is asked for.

The short answer

SVG for icons, logos, illustrations, charts, anything geometric, anything that needs to scale or change colour. PNG for photographs, screenshots, complex artwork, and anywhere SVG is not supported. If you are unsure and the image has flat colours and defined edges, it is an SVG.

Scaling: the headline difference

An SVG at 16px and the same SVG at 1600px are the same file, and both are perfectly sharp. The browser redraws the shapes at the requested size every time.

A PNG has a fixed pixel count. Display it smaller and the browser discards information, which is fine. Display it larger and the browser has to invent pixels, which is not, and the result is the soft, slightly smeared look everyone recognises.

This is why responsive design pushes hard toward SVG for interface graphics. One SVG covers every breakpoint and every display density. Doing the same with PNG means exporting at 1x, 2x and often 3x, then writing srcset to serve the right one.

File size, and where the crossover is

The comparison people expect is "SVG is smaller", and that is true only for a specific class of image.

ImageSVGPNG at 2xWinner
Simple UI icon, one pathUnder 1KB2 to 5KBSVG, comfortably
Multi-colour brand logo3 to 15KB5 to 20KBUsually SVG
Detailed illustration50 to 500KB40 to 150KBOften PNG
PhotographNot viableLarge, but worksPNG, or better, WebP

The crossover is about complexity, not subject. SVG file size scales with the number of shapes, so a hand-traced illustration with ten thousand nodes can be far larger than a photo of the same thing. PNG file size scales with pixel dimensions and colour variety, so it stays flat regardless of how complicated the artwork is.

Two practical notes. SVG is text, so it gzips extremely well, often to a third of its size, and any decent server does this automatically. And an unoptimised SVG straight out of a design tool can easily be three times larger than it needs to be, which is the subject of the optimisation guide.

Colour control and theming

This is the difference that changes how you build, and it is underrated next to the scaling argument.

An inline SVG using currentColor inherits the CSS color of its context. Which means hover states, focus states, disabled states, dark mode and brand theming all work with no icon-specific code at all.

.btn        { color: #444; }
.btn:hover  { color: #FF5A36; }   /* icon follows */
[data-theme="dark"] .btn { color: #EEE; }  /* icon follows */

To do the same with PNG you need a separate file per colour, plus logic to swap between them. For a product with light and dark themes and four interaction states, that is eight files per icon. This alone is usually the deciding argument for interface work. See changing icon colour.

Transparency in both formats

Both support it properly, which is worth stating because a lot of older advice implies otherwise. PNG has a full 8-bit alpha channel, meaning 256 levels of transparency per pixel, so soft edges and drop shadows composite cleanly. This is the main reason PNG survived while GIF, with its single transparent colour and consequent jagged edges, did not.

SVG is transparent by default. There is nothing to enable; anywhere a shape is not drawn, the background shows through.

Accessibility and text

Text inside an SVG is real text: selectable, searchable, readable by screen readers, and indexable. Text inside a PNG is pixels, invisible to everything except OCR.

This matters most for diagrams and charts. An SVG chart with proper title and desc elements is genuinely accessible. A PNG chart is an image with, at best, a summary in the alt text.

Two cautions. SVG text depends on the font being available; if the font does not load, the text reflows and may break your layout, which is why exported SVGs often convert text to paths. And converting text to paths eliminates the accessibility advantage, so it is a real trade rather than a free win.

Security: the reason some platforms block SVG

SVG is XML and can contain <script> elements, event handlers and external references. An SVG uploaded by a user and served from your domain is, in effect, executable content on your origin. That is a genuine cross-site scripting vector, and it is why so many platforms refuse SVG uploads.

If your application accepts SVG from users, sanitise it server-side, strip script elements, event handler attributes and external references, or serve it from a separate domain with a restrictive content security policy. SVGs you author or download from a known source are not a concern. This is a user-upload problem, not an SVG problem.

Decision table

You haveUseBecause
UI iconSVGScales, recolours, tiny
Company logo on your siteSVGSharp at every size, theme-aware
Logo for an email signaturePNGEmail clients strip SVG
Chart or diagramSVGText stays real text
ScreenshotPNGIt is already pixels
PhotographWebP, or PNGSVG cannot represent it usefully
FaviconBothSVG for modern browsers, PNG and ICO fallbacks
Open Graph share imagePNGSocial platforms do not render SVG
Icon in a PowerPoint deckPNGSVG support varies by version
Icon in a printed documentSVG if accepted, else high-res PNGPrint resolution far exceeds screen

Using both

It is not a commitment. Keep the SVG as your source of truth and export PNGs when a destination demands one. That way you always have a clean original to re-export from at any size, which is exactly the position you want to be in when someone asks for the logo at 2000px for a banner.

The ICON OOP tool exports both from the same icon, so you can take an SVG for the site and a 4x PNG for the deck in the same visit. See also SVG to PNG and what is an SVG file.

Frequently asked questions

For icons, yes, in almost every case. SVG scales to any size from a single file, can be recoloured with CSS so hover, focus and dark mode states need no extra files, and is usually under a kilobyte for a simple icon. PNG only wins when the destination does not support SVG, such as email clients and most social platform uploads.
For simple geometric artwork such as icons and logos, SVG is much smaller, often under a kilobyte against several kilobytes for a PNG. For detailed illustrations SVG can become larger, because its size grows with the number of shapes while PNG's grows with pixel dimensions. For photographs SVG is not a viable option at all.
Yes. PNG has a full 8-bit alpha channel giving 256 levels of transparency per pixel, so soft edges and shadows composite cleanly against any background. SVG is transparent wherever no shape is drawn, with nothing to enable. Both are fine; this is not a reason to choose between them.
Not meaningfully in the way people expect. Converting SVG to PNG is straightforward because you are rasterising instructions into pixels. Going the other way requires tracing, where software guesses at shapes from pixel data. It works acceptably for simple high-contrast logos and poorly for anything detailed, and the result is usually a large file with thousands of nodes.
Because SVG is XML and can contain script elements, event handlers and external references. An SVG uploaded by a user and served from your own domain is effectively executable content on your origin, which is a cross-site scripting risk. Platforms that accept user uploads often block SVG rather than maintain a sanitiser. Files you author or download yourself pose no such risk.
SVG as the master file, since it stays sharp at every size and can be themed with CSS. Export PNG versions when a destination requires one, which includes email signatures, social profile images, app store assets and most document tooling. Keeping the SVG as your source means you can always re-export at any size later.

Get icons in either format

Export any icon as SVG or as a transparent PNG at the resolution you need. Free, in your browser.

Open the ICON OOP tool