Base64 to Image Converter
Paste a Base64 string or full data URI to preview the image instantly and download it as a PNG, JPG, GIF, WebP or SVG file.
100% client-side. Nothing is uploaded — decoding happens in your browser.
Base64 to image, explained
A Base64 image string is text standing in for a file's bytes. Decode it and you get the file back — that is the entire contract on this page. Paste a string or a data URI, and the decoder works out which image format the bytes belong to, renders a preview, and saves a real file. The bytes are written out untouched, so what lands in your downloads folder is the original image, not a redrawn approximation of it.
What you can paste
- A complete data URI —
data:image/png;base64,iVBOR...or the equivalent for any supported type. The label announces the format up front. - A bare Base64 body — the payload alone, header stripped. Detection then runs against the decoded bytes, which is why the format still gets identified correctly.
How the format is detected
Every image format writes a fixed signature into its first bytes, and because Base64 is deterministic, each signature has one fixed Base64 spelling. The decoder reads the head of the decoded data and matches it against the known formats:
iVBORw0KGgo— PNG./9j/— JPEG.R0lGOD— GIF, both the 87a and 89a revisions.UklGR— WebP.- BMP — recognized from its
BMheader. - SVG carries no binary signature; it is identified from its XML content or its MIME label.
When the head of the data matches none of these, the decoder stops with an error rather than downloading a file with a guessed extension. That is deliberate: a wrong extension produces quieter failures downstream than a clear error does.
Example Base64 image
A complete value starts like data:image/png;base64,iVBORw0KGgo.... You may paste that entire
data URI or only the part after the comma. Spaces and line breaks are ignored, and URL-safe Base64 is accepted.
Common uses
- Inspect a data URI you found in CSS, HTML or an API response.
- Recover an image that was stored as a Base64 string in a database or config file.
- Sanity-check the output of an encoder before shipping it.
Original bytes versus format converters
This page never re-encodes. The download is the decoded data exactly as the string expressed it — same dimensions, same metadata, same compression choices, same animation if the source had one. Pages aimed at a single output format work differently: Base64 to JPG and Base64 to WebP draw the image onto a canvas and export a fresh encoding, which is how they can change the format at all — and also why their output is not bit-identical to their input. Recover a file here; convert a file on a format page.
When the decode fails
Two failure modes cover most bad pastes. The first is malformed Base64 — characters outside the alphabet, an HTML tag wrapped around the string, a URL pasted instead of a payload. The second is valid Base64 that decodes into something no supported image format claims, which trips the signature check. Both stop before any file is written, and the first case is usually repairable at the source; the repair steps are laid out in fix invalid Base64 image data.
Runs on your device
Detection, preview, and download all happen locally in the browser. The string never travels to a server, so payloads lifted out of internal APIs, private databases, or customer records can be decoded without exposing them anywhere new.
After the file is back on disk
Recovering the original image is usually a middle step rather than the goal. Two follow-ups cover most of what people do with the download:
- Put it back into code. Once the file is renamed, cropped, or otherwise edited, run it through the encoder for its format to produce a fresh data URI for embedding.
- Price the inline before committing. A recovered image can be heavier than the slot it is meant to fill; check the string length it would produce with the Base64 image size calculator before pasting it into a template.
More Base64 converters
Frequently asked questions
How do I convert a Base64 string back to an image?
Paste the Base64 string or full data URI into the box and click Decode to image. The tool detects PNG, JPG, GIF, WebP or SVG, renders a preview, and downloads the original image bytes with the matching extension.
Do I need the data:image prefix?
No. A full data URI like data:image/png;base64,iVBOR... includes a format label, but a raw Base64 body also works because the decoder checks the decoded file signature.
Why do I see “The input contains characters that are not valid Base64”?
The decoder only accepts a raw Base64 body or a full data:image/...;base64, URI. Spaces, line breaks, and URL-safe -/_ characters are handled automatically, but surrounding quotes, an HTML tag like <img src="...">, a plain URL, or an encoded %2F-style string will trigger this error. Paste just the Base64 payload (or the complete data URI) and try again.
Is the decoder private?
Yes. Decoding happens entirely in your browser. Nothing is uploaded, so your data stays on your device.
Which Base64 signatures belong to which format?
PNG strings begin with iVBORw0KGgo, JPEG with /9j/, GIF with R0lGOD, and WebP with UklGR. SVG has no binary signature — the decoder recognizes it from its XML markup or MIME label.
Does this decoder re-encode my image?
No. The format is detected from the file signature and the original decoded bytes are downloaded as-is, so dimensions, metadata, animation, and compression settings all come back exactly as they were.