How to convert SVG to PNG: browser, Mac, Windows, command line
There is an asymmetry at the heart of this task: every modern browser can display an SVG perfectly, yet almost nothing built into an operating system will save one as a PNG. So the job is really renderer-shopping — picking the program whose drawing of your file you trust, and getting pixels out of it at the size you need. Here is every route that reliably works, from a browser tab to a Python one-liner.
1. In the browser — any OS, no install
The fastest reliable renderer is the one you are reading this in. The SVG to PNG converter uses it directly: drop the file or paste its markup, pick a background — transparent is the default, white or black flatten it — choose the size, and download. The conversion happens on a canvas in your own browser, so the file is never uploaded, and it behaves identically on macOS, Windows, Linux or a tablet.
Size comes as 1×, 2× and 4× multiples of the file's intrinsic dimensions, or as an exact pixel width or height up to 8192 px when the deliverable is a fixed size. Because rasterisation happens after scaling, a 24 px icon exported at 2048 px comes out sharp — the vector is re-rendered, not upscaled.
2. On a Mac or Windows PC
The honest version of the "on Mac" and "on Windows" answer: the built-in tools mostly refuse. macOS Preview does not open SVG files at all, and the stock Windows viewers are inconsistent about them. The dependable native renderers on both systems are the browser you already have and, for heavier use, Inkscape — free, open source, and the same on both platforms.
In Inkscape the interactive route is File → Export: pick the page, drawing or a selection, type an exact width or height in pixels, and export. Where Inkscape earns its install is volume and repeatability — batches, the same export size every time, and the command line below.
3. From the command line
Two renderers cover nearly every scripted need:
# Inkscape 1.x — height follows the aspect ratio inkscape logo.svg --export-type=png --export-width=1024 # librsvg (brew install librsvg · apt install librsvg2-bin) rsvg-convert -w 1024 logo.svg -o logo.png
rsvg-convert is small and fast and renders most files exactly as Firefox would; Inkscape is slower to start but copes with more exotic content. The one to be wary of is ImageMagick: magick logo.svg logo.png works, but depending on the build it renders with its own limited SVG code or silently delegates to whichever of the other two is installed — same command, different pixels on different machines. If you use it, make sure a real delegate is present.
4. From Python or Node
For conversion inside a program rather than a shell:
# pip install cairosvg
import cairosvg
cairosvg.svg2png(url='logo.svg', write_to='logo.png', output_width=1024)// npm install sharp — librsvg under the hood
await sharp('logo.svg').resize(1024).png().toFile('logo.png')Both keep transparency by default and take explicit output sizes. The caveats are the renderer's, not the language's: neither fetches external webfonts, so convert text to paths first if typography must survive — the Text to Path tool exists for exactly that.
5. Getting the size and background right
Two decisions recur no matter which route you take. Size: export at the size the PNG will be displayed, or double it for high-DPI screens — a PNG scaled up after export is where the blur everyone complains about comes from. When a platform demands exact dimensions (1200×630 social cards, 1024×1024 store icons), set them at export time rather than resizing the raster afterwards.
Background: SVG has no background — where nothing paints, a PNG keeps transparency. That is usually what you want, and every tool here preserves it. Flatten to white only when the destination cannot handle alpha. And if the export comes out at a strange size or fails outright, the file itself probably lacks a usable viewBox — the viewBox guide explains the fix in two minutes.