Skip to content
SVGtoReact

Canvas in the browser

SVG to PNG

Paste or upload an SVG, confirm the pixel size, and download a PNG. Rasterizing uses the browser canvas. The file never leaves this tab.

Scripts and foreignObject elements are stripped before the image is drawn. They do not appear in the PNG.

PNG export

Runs in your browser. Your SVG is not uploaded.

Waiting for an SVG

Scale

Background

Output size

Suggested size uses the width and height attributes, then the viewBox, then 24 px. White and dark are flattened into the file. Transparent keeps the alpha channel. The checkerboard is only the preview.

Limit 500 KB and 10,000 elements. Scripts and foreignObject elements are removed and do not appear in the PNG.

PNG preview

PNG preview will appear here.

How the PNG size is chosen

The suggested size comes from the width and height attributes, including values written as px. A percentage such as 50% is that fraction of the viewBox on the same axis. With no usable viewBox, the percentage is of the 24 px default. If an axis has neither a usable length nor a viewBox, it is 24 px. That is the same fallback the React converter uses.

Scale can be 1×, 2×, or 4×. You can type a different width and height, then use the suggested size again if you want the attribute, viewBox, or default back. The preview and the download use that confirmed size. The long side stops at 4096 px, and the total number of pixels stops at 4,194,304, so a huge viewBox cannot allocate an unbounded canvas.

What is drawn

Only the sanitized SVG is drawn. Scripts, event handlers, embedded HTML inside foreignObject, and external URLs are removed first. A stripped script or foreignObject does not appear in the PNG. Malformed XML, a document type, or an entity declaration is rejected, and the page shows that error instead of a file.

Need a React component instead? Use the converter, the JSX page, or the TSX page. The optimizer is a separate tool and still keeps its own defaults.

Limits

  • 500 KB per SVG. Larger files are rejected and are not drawn.
  • 10,000 elements. A larger tree is rejected.
  • 4096 px on the long side.
  • 4,194,304 pixels total, so the canvas memory stays bounded.
  • The SVG is sanitized before it is previewed or downloaded.

Questions

Is my SVG uploaded?

No. Sanitizing and rasterizing run in this browser tab. The SVG is not sent to a server, saved in a database, or sent to analytics. The PNG is created locally. Download stays on your device. Closing the tab discards the file.

Will scripts or foreignObject elements appear in the PNG?

No. The same sanitizer as the converter removes scripts, event handlers, foreignObject elements, and external URLs before anything is drawn. Stripped scripts and foreignObject content do not appear in the preview or the downloaded PNG.

How is the PNG size chosen?

Width and height attributes are used first. A percentage is a fraction of the viewBox, or of 24 px when there is no viewBox. Otherwise the viewBox size is used, then 24 px. Scale multiplies that size. You can type a different width and height. The long side is capped at 4096 px and the total area at 4,194,304 pixels.

Does a transparent background stay transparent?

Yes. Transparent leaves the alpha channel empty where the SVG does not paint. White and dark flatten that color into the file. The checkerboard behind a transparent preview is not part of the PNG.