Lean Image
Open menu

The SVG format

An SVG is not an image in the sense the other formats here are. It contains no pixels — it contains instructions for drawing, in XML you can open in a text editor, and the picture only exists once something has followed them. That single difference explains everything SVG is brilliant at, and the one thing it can never do.

SVG at a glance

Introduced
2001 · W3C
File extensions
.svg
MIME type
image/svg+xml
Compression
Lossless
Transparency
Yes, with soft edges
Animation
Yes
Colour depth
8 bits per channel
Wide gamut
sRGB only
High dynamic range
No
Maximum dimension
No practical limit
Support
Every current browser; some older software will not

Lean Image reads SVG but cannot write it.

What an SVG actually is

Open one in a text editor and you find XML: a <path> with a string of coordinates, a <circle>, a <text> element with real text inside it. Scalable Vector Graphics became a W3C recommendation in 2001, after the working group merged two competing submissions — Adobe’s PGML and Microsoft’s VML — into a single specification that neither company had proposed on its own.

Because the file is markup, it behaves like source code rather than like an asset. It diffs sensibly in version control, it can be edited by hand or generated by a script, and it is the only format on this site you can usefully grep.

What it is good at, and where it stops

Vectors are the right answer for logos, icons, diagrams, charts and line art: anything built from flat colour and hard edges. One file serves every screen density and every zoom level, because the shapes are re-drawn at whatever resolution is asked for rather than resampled. Text stays text, so it can be selected, searched and read by a screen reader. For that kind of artwork an SVG is usually smaller than the set of PNGs it replaces.

It stops at photographs. There is no sensible way to describe a photograph as shapes, so an SVG “of” a photo is almost always a base64-encoded JPEG wrapped in a few lines of XML — bigger than the JPEG, with none of the advantages of either.

Rasterising is one-way by nature

Drawing an SVG produces pixels, and pixels do not remember the instructions that produced them. This is not a limitation of this tool or of any other; it is what the operation is. Auto-tracing exists and it approximates: a twenty-path logo comes back as several hundred curves that nearly match the raster, larger than the original file and unpleasant to edit. It does not recover the artwork, it re-guesses it.

That is why this site converts out of SVG and never into it. There is no honest PNG-to-SVG, only a PNG-to-something-that-resembles-SVG, and calling it a conversion would be a misdescription.

How this tool draws one

Every other format here is decoded inside a Web Worker. SVG cannot be, because createImageBitmap rejects SVG blobs in both Chrome and Safari — so a vector is rasterised on the main thread instead, by loading the markup into an image element and letting the browser’s own renderer do the work. It is then handed to the worker as pixels, and the rest of the pipeline is identical.

Loading it that way has a useful side effect. An image element fed from a blob URL runs no script and fetches no subresources, so a hostile SVG has nothing to reach for — and equally, a well-meaning one cannot pull in a webfont it depends on.

The other thing a vector needs is a decision about resolution, since it has none of its own. A file that declares a width and a height is drawn at that size; a file with only a viewBox is drawn at 1024 px on its long edge. Setting a maximum width renders the vector at that size directly, so the edges stay crisp instead of being enlarged from a smaller draw.

What to convert it to

PNG for almost everything. Lossless, transparent where the source was, and hard edges stay hard. Decide the pixel size deliberately — that decision is the entire conversion.

WebP where the destination is a web page and the file size matters more than the last decade of software compatibility.

JPG rarely. It has no transparency, and its compression puts visible ringing along exactly the sharp edges that made the artwork worth drawing as vectors.

Whatever you export, keep the SVG. The raster is a derivative made for one size; the vector remains the master.

Convert a SVG into something else

Questions about SVG

Can I convert a PNG or a JPG into an SVG?

Not meaningfully, and not here. Tracing software can approximate a raster with curves, but it is guessing at shapes that were never in the file — the output is usually larger than the input, awkward to edit, and only roughly the picture you started with. Nothing recovers paths that were flattened away.

What size does an SVG convert at?

Whatever the markup declares. If the file states a width and a height, that is the size used; if it carries only a viewBox, there is no original size to honour and it is drawn at 1024 px on its longest edge. Set a maximum width and it is rendered at that size rather than enlarged to it.

Why does my converted SVG look wrong?

Usually fonts or external references. The vector is drawn through the browser as an image, which by design fetches no subresources — so a typeface loaded from elsewhere, or an image referenced by URL, is simply absent. Converting text to outlines before exporting fixes it permanently.

Is SVG animation preserved when I convert?

No. SVG can animate through SMIL, CSS or script, and rasterising captures a single frame of it — the first, static state. If the animation matters, keep the SVG and use the raster only where a static image is what is wanted.

Are SVG files safe to accept from strangers?

Treat them as documents rather than images: an SVG can contain script and external references, which is why many sites refuse user-uploaded ones. Here the markup is never put into the page — it is loaded through an image element from a blob URL, where scripts do not run and no subresource is fetched.

Work with a SVG file

Drop one in and see what comes out, without uploading anything.