Base64 to SVG Converter
Paste a Base64 string or full data URI to preview vector SVG markup instantly and download it as an .svg file.
100% client-side. Nothing is uploaded — decoding happens in your browser.
Base64 to SVG, explained
SVG is not a picture of a shape; it is a description of one. The file is XML — <path>,
<rect>, <circle>, <g>, style rules, and coordinates
— which the renderer draws at whatever size you ask for. That is why this decoder takes a different route from
the raster pages on this site. It base64-decodes the string, checks that the bytes really are SVG, and hands
you back the original markup. There is no canvas step and no re-encode, so nothing about the vector data is
altered on the way through.
Why rasterizing would ruin the file
The tempting shortcut with any "convert to image" tool is to render the source into a bitmap and save that.
For SVG it destroys the only thing that makes the format useful. A canvas snapshot bakes in one resolution:
the file becomes pixels, stops scaling cleanly, and can no longer be edited as markup. A 24-pixel icon
rendered at 24 pixels is a 24-pixel PNG with a vector's name. Keeping the original bytes means the file you
download still opens in a text editor, still scales to a billboard, and still responds to
currentColor and CSS variables.
The trade-off is that this page cannot rescue malformed input. If the decoded bytes are not valid SVG, there is nothing to hand back, and the decoder rejects the string instead of producing a broken file. That is stricter than a raster tool, and it is the correct behaviour.
Two kinds of SVG data URI, and how to tell them apart
An inline SVG can be carried in a data URI in two ways, and both are legitimate:
- Base64 —
data:image/svg+xml;base64,PHN2ZyB4bWxucz0.... The body is a Base64 alphabet: letters, digits,+,/, and=padding. It usually begins withPHN2Zy, which is<svgafter encoding. - Percent-encoded —
data:image/svg+xml,%3Csvg%20xmlns%3D.... The body is the markup itself with reserved characters escaped as%XX. It often still contains readable tag names and attribute values.
The presence of ;base64, after the MIME type is the definitive marker. If it is there, decode as
Base64. If it is absent, the body is text that needs percent-decoding, and pasting it into a Base64 decoder
will produce garbage or an error. A raw percent-encoded URI is also usually shorter, because SVG is mostly
ASCII and Base64 spends roughly a third of its length on overhead.
Many SVGs you find in stylesheets are the percent-encoded kind, because hand-authored CSS tends to use the shorter form. If you need to go the other direction and produce a Base64 URI from a file, SVG to Base64 is the encode counterpart.
What you can paste
- A full data URI —
data:image/svg+xml;base64,PHN2Zy.... Names the exact format and is the most reliable input. - A bare Base64 body — verified as SVG before it is previewed or downloaded.
- A wrapped string — line breaks from a formatter or an email client are tolerated.
Raster input cannot become a real SVG
This page accepts image/svg+xml data only. A PNG, JPEG, GIF, or WebP string is rejected, because
there is no vectorization step here — tracing a bitmap into paths is a different problem with a different set
of tools, and the result is an approximation, not a recovery. If you paste an unknown string and are not sure
what it holds, Base64 to image auto-detects the format and shows you the
preview first.
SVG can carry scripts — context decides whether they run
SVG is an XML document format, and XML documents can contain <script> elements and event
attributes such as onload. Whether that code executes depends entirely on how the file is
loaded, and the difference is not cosmetic:
- Opened directly as a document — navigating to the
.svgURL, or loading it in an<iframe>or<object>— the SVG runs as its own document in most browsers, and embedded scripts can execute in that origin. - Referenced from
<img>or CSSurl()— the SVG is treated as an image, scripts do not run, and external resources are not fetched. This is the safe embedding path and the one used for icons.
The practical rule: treat any SVG from an untrusted source as executable content until you have looked at it.
Decoding it here does not sanitize it — this page returns the original bytes unchanged, including any script
elements. If you plan to serve user-uploaded SVG, strip <script>, event handler
attributes, and javascript: URLs server-side, and serve the files with a restrictive
Content-Security-Policy. Serving them from a separate origin is the more durable fix.
When you actually want a raster instead
Vector is the right default for icons, logos, and diagrams, but it is the wrong answer in a few situations. Some platforms reject SVG uploads outright. Email clients handle inline SVG inconsistently at best. And an SVG built from thousands of traced paths can end up larger than a well-compressed PNG.
In those cases, rasterize deliberately rather than by accident: Base64 to PNG keeps transparency and hard edges, while Base64 to WebP produces a smaller file for the same visual result. Pick the target size before converting, because a rasterized icon is locked to whatever dimensions you chose.
Private by design
Decoding happens in the tab. The string is turned into a blob URL locally so the preview can render, and the download is written from the same in-memory bytes. No request leaves the browser, which matters here more than usual: an SVG can contain internal hostnames, font paths, or comments you would rather not hand to a third-party server.
More Base64 converters
Frequently asked questions
How do I convert a Base64 string to an SVG?
Paste the Base64 string or full data URI into the box and click Decode to SVG. The tool verifies the SVG markup, previews the vector, and downloads the original .svg file.
Why use SVG instead of PNG?
SVG is vector, so it stays sharp at any size and is usually smaller for line art and logos. PNG is better for detailed photos.
Is the decoder private?
Yes. Decoding happens entirely in your browser. Nothing is uploaded, so your data stays on your device.