Skip to the content

SVG to PNG

Render an SVG as a PNG at any size, with a transparent background.

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

From shapes to pixels

An SVG describes a drawing as shapes: a circle here, a line there. It has no pixels of its own, which is why it stays sharp at any size. A PNG is a fixed grid of pixels. Converting means deciding how many pixels the drawing gets, and that can't be repaired afterwards: a 24 × 24 PNG enlarged to 96 × 96 is a blur, while the same SVG converted at 96 × 96 is crisp.

That is what the size setting is for. The drawing is not converted small and then enlarged. Your browser draws the shapes again at the size you ask for.

Why 2× and 3×

Many screens use two or three physical pixels for every pixel a web page counts with. Nearly all phones do, and many laptops. An icon that is 24 pixels wide on the page is drawn there with 48 or 72 real pixels. If the PNG only has 24, the browser has to stretch it and it looks soft next to the text around it. So for an icon shown at 24 × 24, export it at 2× or 3× and keep displaying it at 24.

For print the reasoning is the same with other numbers. A picture printed 10 cm wide at 300 pixels per inch needs about 1180 pixels across.

Where the original size comes from

The size of the SVG is read from the width and height of its outermost <svg> element. Units are converted the way browsers do it, at 96 pixels to the inch, so 1in is 96 px and 1pt is a third more than a pixel. When the width or the height is missing, or given as a percentage, it follows from the viewBox. A file with none of the three gets 300 × 150, the size browsers fall back to.

The result can be at most about 16 megapixels, which is 4096 × 4096 for a square drawing. Some browsers can't draw anything larger.

Transparency

Whatever the drawing doesn't cover stays transparent in PNG and WebP. The preview shows it as a checkerboard. JPEG has no transparency, so there the background is filled with a color: white, unless you pick another.

What can go missing

The conversion is done by your browser, which draws the SVG the way it would draw any picture on a page. A browser gives an SVG that is used as a picture no access to other files, and that has two consequences.

  • Fonts. Text is drawn with the fonts installed on your device. A web font that the SVG loads from an address is not fetched, so the text falls back to another font, with other letter widths. To be sure of the result, convert text to outlines in the program that made the SVG.
  • Linked pictures. An <image> that points to a file or a web address stays empty. Pictures embedded in the SVG as a data URI are drawn.

Nothing is uploaded. The SVG is read and drawn on your own device.

See all 8