PNG vs SVG

SVG for anything drawn; PNG for anything photographed or already flattened.

Choose PNG when

Screenshots, photographs, and any artwork you only have as pixels. A PNG is a grid of pixels and enlarging it can only invent the ones in between.

Choose SVG when

Logos, icons and diagrams, where the file describes shapes rather than pixels. One SVG is sharp at any size, on any screen, and is usually a fraction of the bytes.

The thing that catches people out

You cannot turn a PNG into a real SVG by converting it. The result is either a traced approximation or the same pixels wrapped in an SVG, which is larger and no sharper.

Switching from PNG to SVG

What survives

Nothing is discarded. PNG and SVG both store their content losslessly, so the conversion is a change of packaging rather than a change of quality, and it can be repeated without accumulating damage.

Transparency survives. Both PNG and SVG store an alpha channel, so a cut-out stays cut out and nothing is filled in behind it.

What the target format adds

SVG is a working format and PNG is a finished one. What comes back is editable text and objects rather than a picture of a page, which is usually the reason for the conversion and also where its limits are.

SVG can hold animation; a PNG is one frame. The result is a single-frame file in a format that could hold more.

SVG supports layers. A PNG arrives already flattened, so the result has one layer — the structure has to be rebuilt by hand if it is needed.

Opening the result

The usual programs do not overlap: PNG opens in Adobe Photoshop, GIMP and Paint.NET, SVG in Inkscape, Adobe Illustrator and Figma — so whoever receives the result needs something from the second list.

File size and quality

SVG stores the samples raw, so the file grows substantially without gaining anything. It is the right direction only when a program on the far side refuses PNG, which is the usual reason for doing it.

What each format is for

PNG is PNG Development Group's format, published in 1996. It records 16 bits per channel.

SVG comes from W3C and dates from 2001, specified as SVG 1.1. Inkscape, Adobe Illustrator and Figma all read it.

Switching from SVG to PNG

What is lost

SVG describes shapes and PNG stores pixels. The result is sharp at the size it was rendered and no sharper — enlarging it afterwards can only invent the pixels in between, which is why the export size matters more here than in most conversions.

PNG holds a single still image. An animated SVG keeps its first frame and loses the rest, so a conversion is a way to take a still out of one, not a way to move it.

Layers are merged. SVG keeps them separate and editable; PNG stores the composite, so anything that depended on moving a layer afterwards has to happen before the conversion.

What survives

Nothing is discarded. SVG and PNG both store their content losslessly, so the conversion is a change of packaging rather than a change of quality, and it can be repeated without accumulating damage.

Transparency survives. Both SVG and PNG store an alpha channel, so a cut-out stays cut out and nothing is filled in behind it.

Opening the result

The usual programs do not overlap: SVG opens in Inkscape, Adobe Illustrator and Figma, PNG in Adobe Photoshop, GIMP and Paint.NET — so whoever receives the result needs something from the second list.

File size and quality

PNG packs the same samples into roughly half the space. Nothing is discarded — decode it and you get the SVG back bit for bit — which makes it the better shelf for anything you intend to keep.

What each format is for

SVG is W3C's format, published in 2001. The specification is SVG 1.1, and it is worth reading if the file has to outlive the tool that wrote it.

PNG comes from PNG Development Group and dates from 1996, specified as ISO/IEC 15948. Adobe Photoshop, GIMP and Paint.NET all read it.

Side by side

PNG and SVG compared row by row: what each stores, and what it costs.
PNGSVG
Full namePortable Network GraphicsScalable Vector Graphics
Extension.png.svg
Media typeimage/pngimage/svg+xml
CompressionLossless — nothing is discardedUncompressed
This site can write itYesYes

A grid of pixels against a set of instructions

A PNG is a grid. It records a colour for every position, and that grid has a fixed size decided when the file was made. Everything a PNG can ever show is already in it.

An SVG is a description: draw a circle here with this radius, stroke this path in this colour, fill this shape. Nothing is decided until it is displayed, so the same file renders at 16 pixels and at four metres with the same crispness. That is not a better kind of image — it is a different kind of thing, and it is why the two formats are good at almost nothing in common.

Scaling is the whole point of SVG

Enlarging a PNG can only invent the pixels in between, and every method of inventing them is a compromise between blurry and blocky. A 200-pixel logo blown up for a banner looks exactly as bad as it sounds.

An SVG has no native size to leave. The same file is the app icon, the favicon, the header logo and the print artwork, and on a high-density screen it is sharp without anybody producing a second and third copy at double and triple resolution. For a logo, that alone usually settles the format question.

What SVG cannot do

Photographs. A photograph is not made of shapes, and there is no set of instructions that reproduces one — tracing software will approximate it with thousands of coloured polygons, producing a file that is larger than the PNG, slower to render and visibly wrong.

The same applies to screenshots, scans, textures and anything with genuine photographic detail. If the image came from a camera or a screen capture, it is a raster image, and converting it to SVG is a mistake rather than an upgrade. The one honest exception is deliberately tracing simple artwork — a hand-drawn logo, a black-and-white silhouette — where the result is meant to be a redrawing rather than a copy.

An SVG is text, and that has consequences

Open one in an editor and it is readable XML. A colour can be changed with a find-and-replace, an icon can be recoloured from CSS, individual parts can be animated or made interactive, and a version control system can show a meaningful diff between two revisions of a logo.

It also means an SVG can contain a script, which is why the format is a genuine security consideration. An SVG uploaded by a user and served from your own domain can run JavaScript in that origin. Sanitise anything that arrives from outside, or serve it in a way that cannot execute — this is not theoretical, and it is the reason many upload forms refuse the format outright.

Fonts are the trap in a logo

An SVG containing text refers to a font by name, and if the machine displaying it lacks that font, something else is substituted — so a wordmark drawn in a licensed typeface arrives in Arial, at a different width, with the layout broken.

The fix is to convert text to outlines before exporting a logo. The letters become paths, they render identically everywhere, and the file no longer depends on anything. The cost is that the text is no longer editable or selectable, which for a logo is correct and for a diagram with labels may not be.

Which to use, concretely

SVG for logos, icons, interface graphics, charts, diagrams, maps and illustrations — anything drawn rather than captured. It scales, it is usually smaller, it can be styled and animated, and it prints at any size.

PNG for screenshots, photographs, textures, and anything already existing as pixels. Also for social media preview images, email, and anywhere an SVG will simply be refused: mail clients, many upload forms, older software and some phone galleries.

The common arrangement is both — an SVG for the site, and a PNG export for the places that will not take one. That is not indecision; it is the same file delivered to two audiences with different tolerances.

Converting between them

SVG to PNG is a render: the instructions are followed once at a chosen size, and the result is pixels. Straightforward, lossless in the sense that nothing was there to lose, and the only decision is what size to render at — which is worth thinking about, because it can no longer be changed afterwards.

PNG to SVG is not really a conversion at all. Either the PNG is embedded inside an SVG wrapper, which changes nothing except the extension, or it is traced into shapes, which is an approximation and only produces a good result from simple flat artwork. For a photograph, neither is worth doing.

PNG or SVG: common questions

Which is better, PNG or SVG?

They are different kinds of file. SVG is for anything drawn — logos, icons, charts, diagrams — because it is instructions and scales to any size. PNG is for anything captured — photographs, screenshots, textures — because those are pixels and cannot be described as shapes.

Can I convert a photograph to SVG?

Not usefully. Tracing approximates a photograph with thousands of polygons, producing a file larger than the PNG that renders slowly and looks wrong. Tracing works only on simple flat artwork, and even then it is a redrawing rather than a copy.

Why does my SVG logo show the wrong font?

It refers to the font by name and the displaying machine does not have it, so something else is substituted. Convert the text to outlines before exporting — the letters become paths and render identically everywhere, at the cost of no longer being editable.

Is SVG smaller than PNG?

For logos, icons and simple illustrations, usually much smaller — a few kilobytes against tens. For anything with photographic detail, far larger, because describing a photograph as shapes takes vastly more instructions than storing its pixels.

Are SVG files a security risk?

They can be. An SVG is XML and may contain scripts, so one uploaded by a user and served from your own domain can run JavaScript in that origin. Sanitise anything from outside or serve it in a form that cannot execute — this is why many upload forms refuse SVG.

Can I use SVG for a favicon or social preview image?

For a favicon, yes — modern browsers accept it, and keeping a PNG or ICO alongside covers the rest. For social media previews, no: those platforms expect PNG or JPG at fixed dimensions and will ignore an SVG.

Decided? Convert it here

Where these figures come from

The claims this page makes about PNG and SVG are checkable, and these are the documents that settle them.