SVG to PNG Converter
Turn an SVG into a PNG at the size you need. The SVG is drawn on your device and never uploaded.
https://flxcode.com/svg-to-png/
or drop it here, or paste the code below
The SVG is drawn as a picture, so scripts inside it never run, and files it points to on other sites are not loaded. Fonts the SVG needs must be installed on this device.
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Quick start
- Choose an SVG file, drop it on the page, or paste the code. Try a sample if you have none.
- Pick a scale such as 2x or 4x, or switch to Width in px and type the width you want.
- Keep the background transparent, or pick a color.
- Press Download PNG.
How the size is worked out
An SVG has no pixels of its own, so the tool reads the size it asks for. Examples from the tool's own code:
| Opening tag | Size at 1x | Why |
|---|---|---|
<svg viewBox="0 0 24 24"> | 24 x 24 px | only a viewBox |
<svg width="2in" height="1in"> | 192 x 96 px | sizes in inches |
<svg width="48" height="48" viewBox="0 0 24 24"> | 48 x 48 px | width and height win over the viewBox |
<svg width="200" viewBox="0 0 100 50"> | 200 x 100 px | one side given, the other from the viewBox |
<svg width="100%" height="100%"> | 300 x 300 px | percent sizes, no viewBox |
An icon with a 24 x 24 viewBox gives these PNG sizes:
| Scale | PNG size |
|---|---|
| 1x | 24 x 24 px |
| 2x | 48 x 48 px |
| 4x | 96 x 96 px |
| 8x | 192 x 192 px |
| 16x | 384 x 384 px |
A logo with a 120 x 40 viewBox, saved at a width of 1200 px, comes out 1200 x 400 px.
How it works
The tool sets the output width and height on the root tag, so the browser draws the vector at the final size and does not stretch a small bitmap. If the file has no viewBox, one is added from the old size.
Here is the tag for the 24 x 24 icon at 4x: <svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24">.
The result is drawn on a canvas, filled with your background color if you picked one, and saved as PNG.
What an SVG can and can't do here
The file is turned into a blob address and drawn through an image element. In that mode browsers don't run scripts or follow links, and this page's content security policy blocks loads from other sites. So a file from someone else can't run code on this page, and it can't phone home to fetch parts. Parts that depend on outside files are simply missing from the PNG.
Numbers this uses
- CSS units at 96 dpi: 1 in = 96 px, 1 pt = 1.333 px, 1 pc = 16 px, 1 cm = 37.8 px, 1 mm = 3.78 px (CSS Values and Units).
- No size and no viewBox: 300 x 300 px, the same default as a browser picture of that kind.
- Limits: 8192 px per side, 64 megapixels, a 5 MB file (this site's limits for phone memory).
Privacy
Nothing you choose or paste is uploaded or stored. We count events without cookies, such as "PNG saved" (details).
FAQ
How do I convert an SVG to PNG?
Choose the SVG file, or paste its code, pick a scale or a width, and press Download PNG. The browser draws the SVG at that size and saves it, so the lines stay sharp.
What size will the PNG be?
It uses the size the SVG declares in its width and height, or the viewBox if there are none, multiplied by the scale you choose. Or type the width you want and the height follows the shape. The line under the controls shows the exact pixels.
How do I keep the background transparent?
Leave Background on Transparent. The PNG keeps its alpha channel and shows as a checkerboard in the preview. Choose Color if the place you upload to puts a black background behind transparent PNGs.
What is the biggest PNG I can make?
Up to 8192 pixels on a side and 64 megapixels in total. That limit keeps the page from running out of memory on a phone. For a bigger picture, convert a smaller one and upscale it in an editor, or use a vector format.
Can scripts in an SVG run here?
No. The SVG is drawn as a picture, and browsers do not run scripts in a picture. The page rules also block it from loading files from other sites, so an SVG that links to an outside image or font gets those parts left out.
Why does my text come out in a different font?
An SVG that names a font draws it only if the font is installed on this device. Web fonts linked from another site are blocked. Convert the text to outlines in your editor first, or embed the font in the file.
Why does my SVG come out blank or fail?
Check that it starts with an svg tag, has the xmlns attribute, and is complete. An SVG that uses foreignObject may fail in Safari when saving. A file over 5 MB is refused.
Is my SVG uploaded?
No. It is read and drawn by your browser on this device. The code is not sent, saved or put in the address bar.
More from FLXCode
Favicon GeneratorNew
Make favicon.ico (16, 32, 48), Apple touch, 192 and 512 icons, a manifest and the HTML for them. In your browser.
Color Picker from ImageNew
Click a picture to get the HEX, RGB and HSL of any pixel, plus its dominant colors. Nothing is uploaded.
Blur ImageNew
Blur a whole photo or drawn rectangles, with a strength you set. Nothing is uploaded, and EXIF data is left out.
HEIC to JPG ConverterNew
Convert iPhone HEIC photos to JPG in your browser. Nothing is uploaded, and it works offline.