Base64 to Image Decoder — Convert Data URI to a Downloadable File
Paste a data:image/...;base64, string to preview it and download the original PNG, JPG, GIF, WebP, or SVG. Free and 100% in your browser.
Image preview will appear here
Paste a valid Base64 string to see the image
Base64 to Image Decoder: turn a data URI back into a file
A Base64 to Image decoder takes a data:image/...;base64, string — the ASCII text that represents a picture — and renders it back as a real PNG, JPEG, GIF, WebP, or SVG you can preview and download. Paste the string, see the image, click Download Image. It runs 100% in your browser, free, with no upload.
How to decode a Base64 string to an image
- Copy your full data URI, for example
data:image/png;base64,iVBORw0KGgo..., and Paste it into the input panel. - The preview renders the instant a valid string is detected — the footer shows the detected Format and an estimated KB size.
- If you only have raw Base64 with no prefix, it still auto-detects PNG and JPEG; for GIF, WebP, or SVG, prepend the
data:image/...;base64,header. - Click Download Image to save the file locally as
decoded-image.<ext>in its original format. - Use Clear (the trash icon) to reset the input and preview before pasting the next string.
What is a data URI, and how does decoding work?
A data URI embeds a file directly inside a URL instead of pointing to one on a server. The scheme is defined by RFC 2397, which gives the form data:[<mediatype>][;base64],<data>. The ;base64 marker tells the browser the payload is RFC 4648 Base64; the comma separates the header from the encoded bytes. Per the spec, when the media type is omitted it defaults to text/plain;charset=US-ASCII, so an image data URI must state its type explicitly — image/png, image/jpeg, and so on.
"If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII. As a shorthand, 'text/plain' can be omitted but the charset parameter supplied."— RFC 2397, "The 'data' URL scheme" (IETF, August 1998)
Decoding reverses Base64 back to raw bytes. Because Base64 maps every 3 binary bytes to 4 ASCII characters, the encoded text is roughly 33% larger than the file it represents (MDN data: URLs). This decoder strips whitespace, validates the data:image/…;base64, prefix, then hands the URI straight to an <img> tag for preview and to a download link for the file — all in your browser, no server round-trip.
Worked examples: string → result
Full PNG data URI
data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...
Renders instantly. Format reads PNG; download saves decoded-image.png.
Raw Base64, no prefix (PNG/JPEG only)
iVBORw0KGgoAAAANSUhEUg... or /9j/4AAQSkZJRgABAQ...
Auto-detected via the \x89PNG / \xFF\xD8\xFF signature, then wrapped in a data URI for you.
SVG data URI
data:image/svg+xml;base64,PHN2ZyB4bWxucz0i...
The +xml suffix is dropped on download, so the file saves as decoded-image.svg.
Edge case · raw GIF/WebP/SVG fails to detect
Signature auto-detection only covers PNG and JPEG. Paste raw Base64 for a GIF, WebP, or SVG with no header and you get "Could not detect image type". The fix is to prepend the correct prefix, e.g. data:image/webp;base64,. A URL-encoded data URI (percent escapes instead of ;base64,) also fails — convert it first with the URL Encoder / Decoder.
Image media types and what this decoder does
Real behavior of this tool by format. "Raw auto-detect" means a prefix-less Base64 string is recognized from its file signature; everything else needs the full data URI.
| Format | Media type prefix | Raw auto-detect? | Saved as |
|---|---|---|---|
| PNG | data:image/png;base64, | Yes (\x89PNG) | decoded-image.png |
| JPEG | data:image/jpeg;base64, | Yes (\xFF\xD8\xFF) | decoded-image.jpeg |
| GIF | data:image/gif;base64, | No — prefix required | decoded-image.gif |
| WebP | data:image/webp;base64, | No — prefix required | decoded-image.webp |
| SVG | data:image/svg+xml;base64, | No — prefix required | decoded-image.svg |
The KB size shown is an estimate — here is the math
The footer size is computed as encodedLength × 0.75 / 1024, rounded to whole KB. That 0.75 is the inverse of Base64's expansion: 4 ASCII characters carry 3 bytes, so the decoded file is about three-quarters the length of the pasted text, or roughly 33% smaller. It is an approximation — it counts the whole string including the data:image/png;base64, header and ignores = padding, so for tiny images the real file can differ by a few bytes.
That 33% inflation is also why data URIs are a poor fit for large images: inlined bytes cannot be cached separately from the page and are re-parsed on every load. The sweet spot is small icons under ~2 KB, where saving one HTTP round-trip beats the size penalty. For anything bigger, decode here and serve it as a real file — then re-inline with the Image to Base64 encoder only when it genuinely helps.
Runs 100% in your browser
Your image data never leaves your device. The string is parsed in JavaScript and the preview points straight at the data URI — no uploads, nothing leaves your device, which matters when the picture is a private screenshot or a company logo. I tested this with full PNG, JPEG, and SVG data URIs, with prefix-less PNG/JPEG strings, and with whitespace-laden multi-line input copied from minified CSS; the preview stayed instant and the download produced the correct extension every time.
Frequently asked questions
Is this Base64 to Image decoder free?
Yes — 100% free, no signup, no watermark. The output is your own original image file, and there is no cap beyond your browser's memory.
Does my data get uploaded?
No. Decoding runs entirely in your browser with JavaScript, so the string never reaches a server. The tool works offline once the page has loaded.
Why won't my string render?
Usually a bad prefix. The decoder needs the literal ;base64, marker and a data:image/ type. A percent-encoded (URL-encoded) data URI will not render — convert it with the URL Encoder / Decoder first.
Can I paste raw Base64 without the data: prefix?
For PNG and JPEG, yes — they are auto-detected from their file signature. GIF, WebP, and SVG need the full data:image/...;base64, header to render.
Related encoder, crypto & data tools
Encode a file into a data URI
Base64 EncoderEncode any text to Base64
Base64 DecoderDecode Base64 text strings
URL EncoderPercent-encode unsafe characters
URL ParserBreak a URL into its parts
JWT DecoderRead Base64Url token claims
HMAC GeneratorSign data with a secret key
Hash GeneratorSHA-256 and MD5 digests
QR Code GeneratorMake a scannable SVG code
JSON FormatterInspect Base64 fields in API data
Guide: Base64 EncodingHow Base64 and data URIs work
All ToolsBrowse the full Toolk hub
Last updated: June 2, 2026 · Runs 100% in your browser — no uploads, nothing leaves your device.
Need a different tool?
Browse all 89 free, in-browser tools — or tell us what we should build next.