SVG to PNG / JPEG
Turn a self-contained static SVG into a raster image at a chosen width and height. Paste vector code or select a UTF-8 SVG file, inspect the source viewport and choose how it fits the output. The tool checks a supported static subset before rendering; unsupported features are rejected with an explanation.
Key features
- Paste SVG code or open a local UTF-8 SVG file up to 1 MiB
- Read viewBox origins and dimensions, or derive one from explicit pixel dimensions
- Set integer output dimensions up to 8,192px per side and 16 million pixels
- Contain the full viewBox, fill by cropping or stretch to the chosen canvas
- Save transparent PNG, solid-background PNG or JPEG with a quality setting
- Reject external resources, scripts and unsupported constructs before rendering
How to use
- Paste SVG code, select a UTF-8 SVG file or load the original example.
- Read the source size and viewBox with Inspect SVG and use source size.
- Set the output width, height and fit. Select PNG or JPEG and a background.
- Create the raster image and check its actual output dimensions and appearance.
- Download the current result. Change settings and generate again for a new result.
Use cases
- Render a self-contained vector icon at a specific pixel size
- Turn pasted SVG code into a transparent PNG for a document
- Create a JPEG with a chosen background for software without SVG support
- Compare a nonzero viewBox with contain, crop-to-fill and stretch output
Frequently asked questions
How is this different from the existing image format converter?
The general converter opens image files and converts their native decoded dimensions. This tool also accepts pasted SVG source, reports the viewBox, accepts explicit output width and height, and controls fit and background. Basic file-to-PNG conversion overlaps; the SVG code and viewport controls are the additional functions.
Which SVG features are accepted?
The supported static subset includes paths, basic shapes, groups, text and tspans, local linear or radial gradients and simple clip paths. Inline presentation styles are accepted. Scripts, event attributes, external resources, image/use/filter/style elements, animation, foreignObject, DTD, entities including &, CDATA, other namespaces and unsupported attributes are rejected. This is not a universal SVG implementation and rejected features are not silently removed.
How are viewBox and output size related?
A viewBox gives the coordinate origin and dimensions inside the vector. Output width and height set raster pixels. A missing viewBox is derived from positive unitless or px root width and height. With a viewBox, omitted or 100% root dimensions use its ratio. Other root units are rejected. The source-size button rounds down to whole pixels and scales down only when needed to fit output limits; this adjustment is shown.
What do the three fit choices do?
Contain preserves the viewBox ratio and shows all of it, possibly leaving margins. Fill by cropping preserves the ratio but clips the edges. Stretch maps the viewBox to both dimensions independently. These choices explicitly replace the root preserveAspectRatio setting. The output is never trimmed to the visible artwork bounds.
Will fonts and transparency look exactly like the original?
PNG can preserve transparency or use a chosen solid background. JPEG always uses that background. Text uses fonts available to the browser and may fall back; external font files are not loaded. Browser rendering, antialiasing, color handling and JPEG compression can change the result. The checkerboard is only a preview guide.
What are the limits and cancellation behavior?
Input is UTF-8 SVG up to 1 MiB, 2,000 elements and nesting depth 32. Outputs allow 1–8,192px per side and at most 16 million pixels. Cancel discards the pending result. If canvas encoding has already started, its callback must return before another job can begin. The original file is unchanged; saving produces only the newly encoded PNG or JPEG.
Privacy
SVG code, files and results stay in the current page memory. This tool does not upload them, fetch external SVG resources or automatically save them to browser storage. Conversion creates temporary local object URLs that are released after use, replacement or leaving the page. A download saves the raster result on your device.
Comments & questions