SVG or PNG — what to use for a logo, and why SVG isn't an image at all

Open a PNG in a text editor and you'll see garbage. Open an SVG and you'll see readable code:
<svg viewBox="0 0 24 24">
<circle cx="12" cy="12" r="10" fill="#D4A373" />
</svg>
This isn't "another image format". It isn't an image at all. PNG stores finished pixels; SVG stores instructions for drawing them. Everything else follows from that one difference — the file size, the sharpness, and a strange little security hole.
PNG is a grid of pixels
PNG (Portable Network Graphics) is a raster format. Inside is a table: this many dots across, this many down, each with its own colour.
PNG compression is lossless: decompress and you get byte-for-byte what went in. Plus alpha transparency, which is usually the reason people reach for it.
Raster has exactly one downside, but it's fundamental: the size is fixed at export time. You saved the logo at 200 pixels wide — that's its ceiling. Display it at 400 and the browser stretches it, and the edges go soft. That's precisely how you end up with a blurry logo.
SVG is an instruction, not a picture
SVG (Scalable Vector Graphics) stores geometry: a circle with this centre and radius, a line from here to there, filled like so.
The browser draws it, fresh each time, at whatever size is needed right now. That's why SVG is equally sharp on any screen — an old monitor or a phone packing three pixels per point.
The pleasant side effects follow. Because it's text, you can:
- gzip it right at the CDN — vectors compress beautifully;
- colour it from CSS: set the fill to
currentColorand the icon inherits the text colour; - edit it by hand — change a colour or a stroke width without opening a graphics editor;
- ask a model for it: AI can write SVG markup, because it's code rather than pixels.
That last point is worth keeping. If an image generator hands you a raster logo, ask it to generate the icon as SVG code instead — and you get something that scales forever.
The comparison that matters
What counts in practice:
- Sharpness. SVG — perfect at any size. PNG — only at the size you exported.
- Weight. A logo: SVG is usually a few kilobytes, PNG tens of them, and you need two or three versions for different screen densities. A photo: the opposite — SVG balloons, PNG wins by a landslide.
- Number of files. SVG — one for everything. PNG — usually
@1xand@2x, sometimes@3x. - Transparency. Both have it.
- Animation. SVG can do it itself, via CSS. PNG can't.
- Photos and complex gradients. PNG handles them; SVG doesn't — a photograph has no "formula".
- Support. Full on both sides; that question closed over a decade ago.
Where SVG is suddenly risky
Few people know this one, and it matters if you accept file uploads from users.
An SVG is a document, not a picture. Which means it can contain a script.
What saves you is that browsers planned for it. When an SVG is used as an image — via img, via CSS background-image, inside canvas — a restricted mode kicks in:
- JavaScript is disabled;
- external resources aren't loaded;
:visitedlink styles aren't rendered;- native widget styling is turned off.
The key phrase is "as an image". Those restrictions do not apply when the SVG is opened directly by URL or embedded via iframe, object or embed. So:
- embedding someone's SVG through
img— fine; - letting users upload SVGs and serving them at direct links — that's hosting someone else's HTML document on your domain;
- inlining a third-party SVG straight into your markup — same thing, only worse.
The practical takeaway: your own icons, SVG without hesitation. User uploads: either block SVG or run it through a sanitiser and serve it from a separate domain.
Which one for you
No fence-sitting.
Take SVG if it's a logo, an icon, a diagram, a chart, a background pattern — anything drawn from shapes. One file, permanent sharpness, colourable from CSS.
Take raster — PNG or WebP — if it's a photo, a screenshot or a complex texture. No debate: vectors lose here on both weight and looks.
The grey area is an illustration with gradients and fine detail. Judge by file size: once the SVG passes a hundred kilobytes it's carrying too many points, and raster is the honest answer.
And a small everyday rule: if you're about to export @2x and @3x, stop and ask whether SVG would do. Half the time it would.
FAQ
Is SVG always lighter than PNG?
No. SVG is lighter when the object is simple: a few shapes and fills. Every extra path point is more text in the file. A photo traced into vectors can weigh several times its source PNG and still look worse.
Why won't my SVG take a colour from CSS?
Most likely the colour is baked into the file as fill="#000000". Swap it for fill="currentColor" and the shape starts inheriting the text colour. Also worth knowing: you can't recolour an SVG loaded through img — for that it has to be inlined in the markup.
What should I use for a site favicon?
SVG is the convenient answer now: one file for every size, and it can carry a dark-theme variant too. Older browsers don't know about it, so the classic pairing is SVG plus a 32-pixel PNG fallback.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





