Skip to main content

SVG to PNG Converter

Convert SVG vector graphics to PNG raster images at any custom size.

Reviewed by · Last reviewed

How to Use the SVG to PNG Converter

  1. Provide the SVG: paste the markup directly into the code textarea, or click "Upload" to browse for an .svg file. The code editor and file upload both feed the same rendering pipeline.
  2. Review auto-detected dimensions. The tool reads viewBox or explicit width/height attributes from the root <svg> and pre-fills the output size fields with the matching pixels.
  3. Set your output size. Override the width or height to rasterize at any resolution. Enable "Lock Ratio" to keep the aspect ratio when you change one dimension.
  4. Click "Convert to PNG". The SVG is wrapped in a data URL, drawn onto a canvas at your chosen size, and exported via canvas.toBlob("image/png").
  5. Download the PNG file. The output is a lossless raster at the dimensions you specified.

How Vector Becomes Raster

SVG (W3C Scalable Vector Graphics 1.1 and 2.0 Recommendations) is a vector format - the file describes shapes (paths, rectangles, circles, text) as mathematical definitions rather than pixel grids. Converting to PNG requires rasterization: evaluating each shape at a specific resolution and painting the resulting pixels. The browser does this for free via the Canvas 2D context. We construct a data URL data:image/svg+xml;base64,... containing the SVG source, create an Image element with that URL, wait for the load event, and then draw it onto a canvas sized to your target dimensions using ctx.drawImage.

The rendering step uses the browser\'s built-in SVG renderer - the same engine that displays SVG on any webpage - and it honors the vast majority of the SVG specification: fills, strokes, gradients, patterns, clipPaths, masks, filter effects like feGaussianBlur, and text rendering with whatever fonts are installed locally. The canvas then produces a PNG encoded through the standard DEFLATE pipeline per the W3C PNG specification. The output is pixel-identical to how the SVG would look in that size on the current page.

When You Need a Raster Copy

  • Uploading a logo to a platform that rejects SVG (many social media profile pictures, older CMSes, certain banking portals).
  • Sending a vector illustration to a stakeholder via email, where the recipient\'s client may not render SVG attachments safely.
  • Generating 2x and 3x retina assets from a single SVG source, so your CSS can use fixed-resolution srcset for older browsers.
  • Creating social-sharing preview images (Open Graph, Twitter Cards) from a vector design, since most platforms require PNG or JPEG for OG images.
  • Producing a favicon from a vector logo - the Favicon Generator accepts raster inputs, so rasterize first and hand it the PNG.
  • Creating a rasterized backup of an SVG you plan to edit, so there is a stable before-image for visual diffs.

Rasterization Gotchas

  • External stylesheets do not render. If your SVG references a separate CSS file or an @import inside a <style> block, the fetch may not resolve in the isolated data-URL context. Inline all styles and presentation attributes before converting.
  • External fonts need to be embedded. SVG <text> uses the font you installed on the system. If the design uses a web font, either embed it via a CSS @font-face rule inside the SVG, or convert text to paths first in your vector editor.
  • Cross-origin image references fail. SVGs that <image>-tag external raster files from another origin will trigger canvas tainting and block export. Bake any embedded images into the SVG as data URLs first.
  • Very large canvases fail silently. Rasterizing a simple SVG at 10,000x10,000 pixels hits the browser\'s canvas area cap (around 268 million pixels on desktop, 16 million on iOS Safari) and produces a black image. Stay under 4096x4096 for reliable output.
  • Blurry output means a mismatch. If the output looks soft, the source SVG likely has an internal viewBox smaller than the requested output - the browser upscales the intermediate bitmap. Provide explicit width and height on the root SVG element matching the target resolution.

Understanding SVG as a Format

SVG is one of the few image formats that is human-readable XML at heart. Open any SVG in a text editor and you see a tree of elements: <svg> at the root, then <rect>, <path>, <circle>, <text>, and groups wrapping them. The viewBox attribute defines the coordinate system independent of the output size, which is why SVG scales to any resolution without quality loss. SVG 1.1 was published in 2003 and 2011 (second edition), and SVG 2 is a living W3C standard that adds modern CSS integration, new path commands, and tighter HTML5 interoperability. Browser support for core SVG is universal; advanced features like SMIL animations, filters, and <foreignObject> have variable support. PNG output from SVG freezes whatever the browser renders at conversion time, so dynamic elements (animations, scripts) are captured as a single frame.

Browser Rasterizer vs. Dedicated Tools

For a one-off SVG-to-PNG at a specific size, the browser pipeline is the fastest path with solid fidelity. For batch conversion, rsvg-convert from librsvg is the shell-scripting standard: rsvg-convert -w 1024 logo.svg -o logo.png renders hundreds of files per second. Inkscape\'s command-line mode is the most feature-complete option for SVGs that use unusual or non-standard features. ImageMagick\'s magick -density 300 logo.svg logo.png works but internally delegates to librsvg. For pixel-perfect icon rendering across many resolutions, svgexport on npm wraps Puppeteer and gives you a full browser engine in scriptable form.

Frequently Asked Questions

Does my SVG source get uploaded anywhere during conversion?

No. The SVG text is wrapped into a data URL in your browser, drawn onto a canvas locally, and exported as PNG through the native toBlob encoder. Neither the markup nor the rendered pixels travel over the network. You can confirm by opening DevTools and running a conversion while watching the Network panel stay silent.

Why does my text look wrong in the rasterized PNG?

SVG text rendering depends on the system fonts installed where the rendering happens - your browser in this case. If the SVG references a custom font via a CSS import or external <code>@font-face</code>, that font may not be loaded inside the isolated rasterization context. The fix is to either inline the font as a base64 <code>@font-face</code> source inside the SVG, or convert text to path geometry in your vector editor before uploading.

Can I rasterize at very high resolution for print?

Yes, up to the browser's canvas area cap. For print at 300 DPI, a 10-inch wide image needs 3000 pixels, well within the safe zone. For huge posters, you may hit the 16,384-pixel dimension cap on desktop (lower on iOS Safari). Beyond that, use rsvg-convert or Inkscape on the command line where there is no browser-imposed limit.

Does SVG animation get captured in the PNG?

No. PNG is a still format and the rasterization captures a single frame at the moment of conversion - typically the starting state of any SMIL or CSS animation. For animated output, convert to animated WebP or a GIF using a tool that supports time-based rendering, like headless Chromium running a frame loop.

Why is my output larger than the original SVG file?

SVG is often a few kilobytes of text, while a raster PNG at a reasonable size (say 1024x1024) can easily be 50-200 KB. That is expected and is exactly the reason SVG exists - it scales infinitely from a tiny file, while raster images have a fixed, resolution-dependent cost. If file size matters, stay with SVG wherever the consumer supports it.

What happens with CSS filter effects like drop-shadow or blur?

SVG filter primitives (<code>feGaussianBlur</code>, <code>feDropShadow</code>, <code>feColorMatrix</code>) render correctly because the browser applies them during its internal rasterization pass. The resulting PNG has the filter effects baked in as pixel data. CSS-level filters applied to the SVG from outside the document will not affect the rasterization because the SVG renders in isolation.

Can I preserve transparency in the output?

Yes. PNG supports an alpha channel, and the canvas is created with alpha enabled by default. Transparent regions in the SVG (where no shape covers a pixel, or shapes have fill-opacity less than 1) remain transparent in the PNG. This is particularly useful for logos intended to sit on varied backgrounds.

How do I handle embedded raster images inside the SVG?

If the SVG contains <code>&lt;image&gt;</code> elements that reference an external URL, they may fail to load in the isolated rasterization context due to CORS or timing issues. The most reliable approach is to inline the raster image as a data URL inside the SVG before converting - use the Image to Base64 tool to generate the data URL, then paste it into the SVG <code>href</code> attribute.

Why does my SVG look different in Chrome and Firefox?

Browsers occasionally differ on edge-case SVG features: Firefox renders SMIL slightly differently, Safari supports <code>&lt;foreignObject&gt;</code> inconsistently, and text kerning varies by rendering engine. For reproducible output across environments, use rsvg-convert or Inkscape on the CLI, which ship a consistent renderer independent of whichever browser you run.

Can I convert an SVG with masks and clip paths correctly?

Yes. SVG <code>&lt;mask&gt;</code> and <code>&lt;clipPath&gt;</code> are fully supported by modern browser renderers, so the canvas drawing step respects them and produces correct output. Complex nested masks may have subtle rendering differences between browser engines; for pixel-identical output across environments, a CLI tool with a single renderer is more predictable.

Can I paste SVG code directly to convert SVG code to PNG without saving a file?

Yes. The textarea accepts a full SVG fragment - paste from your editor, from a Figma or Illustrator copy, or from a snippet in a design system - and the rest of the conversion runs on the inline markup. You do not need to save the SVG to disk first. The tool reads the pasted SVG code, wraps it as a data URL, draws it to a canvas at the size you choose, and exports a PNG. The "convert SVG code to PNG" path skips the upload entirely.

More Image Tools