Free tool

SVG to PNG converter

Paste SVG code or drop .svg files to get a PNG at any scale or exact pixel size, with a transparent or colored background. Batches download as a ZIP, and one click exports every favicon and app icon size.

Free · no sign-up · runs in your browser, nothing is uploaded

SVG code
Drop .svg files here or click to pick. Several files convert as a batch.
PNG preview · 256×256

Fix the SVG to see the image.

Size and background

SVG size: 128×128 px (from width and height).

Output size

256×256

pixels

File size

-

PNG

SVG code

1.6 KB

rocket.svg

Icon and favicon sizes

Square PNG files of the current SVG, centered with its aspect ratio kept, using the background and padding above. 180 is the Apple touch icon; 192 and 512 are the usual web app manifest sizes.

How the PNG size is worked out

An SVG has no pixels, so the converter needs a size. It reads the width and height attributes of the root <svg> tag and turns their units into CSS pixels. If only one is set, the other follows the viewBox aspect ratio. If neither is set, the viewBox width and height are used. With no size and no viewBox at all, browsers fall back to 300×150, the default size of a replaced element.

UnitPixels (CSS)Note
px or none1width="24" is 24 px
in961 inch = 96 px in CSS
pt1.333…1pt = 1/72 in, so 72pt = 96 px
pc161pc = 12pt
cm37.81 in = 2.54 cm
mm3.78
%-Relative to a container, so the viewBox is used instead

Then the size mode applies. Scale multiplies that size (2x for retina screens). Width or Height sets one side and keeps the ratio. Exact size sets both: the drawing is centered and fitted inside, the way preserveAspectRatio="xMidYMid meet" works, unless you turn on stretch. Each side is capped at 8192 px here so the browser canvas does not fail.

What happens when you convert

The tool rewrites the root tag with the target pixel size and a viewBox, adds xmlns if it is missing (an SVG without it will not load as an image), and draws it with drawImage() on a canvas of that size. canvas.toBlob() then encodes the PNG, JPEG or WebP file. Nothing leaves your browser.

Because the SVG is drawn as an image, browsers apply the same limits as for an <img> tag: scripts do not run, and external images, fonts and stylesheets are not loaded. Inline them (as data URIs or <style>) or convert text to outlines before exporting.

Icons that use fill="currentColor" take their color from the page around them. In a PNG there is no page, so they render black. Set a color in the currentColor picker to export them in your brand color.

Which PNG size to export

UseSizeTip
Favicon16×16, 32×32, 48×48Keep PNG or ICO files for browsers that do not use an SVG favicon
Apple touch icon180×180Give it a solid background color
Web app manifest192×192 and 512×512Add padding if the icon will be masked to a circle
Retina UI images2x or 3x the CSS sizeShow it at the CSS size with width and height set
Social share images1200×630Use Exact size with a background color

The Icon and favicon sizes panel exports any of these square sizes as PNG in one ZIP, plus a favicon.ico with the 16, 32 and 48 px images inside. To shrink the SVG itself before you export, run it through the SVG optimizer.

Convert SVG to PNG from the command line or in code

Inkscape (1.x) renders SVG well, including text with installed fonts:

inkscape logo.svg --export-type=png --export-filename=logo.png -w 512

rsvg-convert (librsvg) is small and fast on Linux and macOS:

rsvg-convert -w 512 logo.svg -o logo.png
rsvg-convert -z 2 -b white logo.svg -o logo@2x.png   # 2x, white background

ImageMagick: put -density before the input file, so the SVG is drawn at a high DPI instead of being scaled up after:

magick -density 300 -background none logo.svg logo.png

Node.js with sharp: the density option (default 72) sets the DPI for vector input.

import sharp from 'sharp';
await sharp('logo.svg', { density: 300 }).resize(512).png().toFile('logo.png');

Python with CairoSVG

import cairosvg
cairosvg.svg2png(url='logo.svg', write_to='logo.png', output_width=512)

Browser JavaScript, the same way this page does it:

const img = new Image();
img.src = URL.createObjectURL(new Blob([svgText], { type: 'image/svg+xml' }));
await img.decode();
const canvas = Object.assign(document.createElement('canvas'), { width: 512, height: 512 });
canvas.getContext('2d').drawImage(img, 0, 0, 512, 512);
canvas.toBlob(blob => { /* save the PNG */ }, 'image/png');

To turn PNG, JPG or WebP into each other, use the image converter. To inline the PNG in HTML or CSS, use image to Base64. More design tools on DevHunt: design tools.

FAQ

How do I convert SVG to PNG?+

Paste the SVG code above or drop the .svg file. The PNG renders at once. Pick a scale (1x to 4x) or type a width, height or exact size, choose a background, then click Download PNG. Several files dropped together convert as a batch and download as one ZIP.

How do I convert SVG to PNG without losing quality?+

Render it at the size you will show it, or larger. An SVG is drawn fresh at any size, so exporting at 2x or 3x gives sharp edges on high-density screens. Scaling a small PNG up later is what makes it blurry.

Does the PNG keep the transparent background?+

Yes. With Background set to Transparent, any area the SVG does not paint stays transparent in the PNG. Choose White, Black or a color to fill it instead. JPEG has no alpha channel, so a JPEG export always gets a background (white by default).

Why is my PNG the wrong size or cut off?+

The size comes from the width and height attributes of the <svg> tag, or from the viewBox when those are missing. Without either, browsers use 300×150. Content outside the viewBox is clipped. Check the "SVG size" line under the size options, or add a viewBox that covers the drawing.

Why are fonts or images missing in the PNG?+

Browsers do not load external files (linked images, web fonts, stylesheets) when an SVG is drawn as an image, and they do not run its scripts. Embed images as data URIs and convert text to paths in your editor, or use a font that is installed on your computer.

Can I make favicons and app icons from an SVG?+

Yes. Pick the sizes in "Icon and favicon sizes" (16 to 1024 pixels) and download them as one ZIP of square PNGs, with a favicon.ico that holds the 16, 32 and 48 pixel versions. 180×180 is the Apple touch icon, and 192 and 512 are the usual sizes in a web app manifest.

Is it safe to convert SVG files here?+

The conversion runs on a canvas in your browser. The file is never uploaded, and the SVG is rendered as an image, so scripts inside it cannot run.

Sources: MDN: SVG as an image · MDN: HTMLCanvasElement.toBlob() · SVG 2: viewBox and preserveAspectRatio · CSS Values 4: absolute lengths · CSS 2.1: replaced elements (300×150 default) · Inkscape command line · sharp constructor (density) · CairoSVG documentation. Checked 2026-10-31.