Base64 to Image
Paste a Base64 string or a data URI to preview the image instantly, check its real format and size, and download it as a normal image file. Decoding happens in your browser.
What this tool is for
Images often travel as Base64 text: an API returns an avatar or a generated chart inside JSON, a CSS file inlines an icon, an HTML email embeds its logo, or a log line contains a screenshot. Reading that text tells you nothing. This tool turns it back into a picture you can see, tells you what the file really is, and lets you save it.
How to use it
- Paste the Base64 string or the whole data URI into Base64 or data URI. Click Load example if you just want to see how it works.
- The preview appears immediately, with the detected type, pixel size and file size above it.
- Click Download to save the image with the right extension, or Copy data URI to get a clean
data:URI with the correct MIME type.
Worked example
The example button loads an SVG data URI that carries an extra charset parameter:
data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0i…
The tool strips the prefix, decodes 248 bytes, recognises the <svg root element, and shows a blue 120×60 badge reading "Hi!". The header reads image/svg+xml · 120×60px · 248 B and the download button offers .svg.
How format detection works
Every image format starts with a recognisable signature. The tool decodes the Base64 and checks those first bytes rather than trusting a label:
- PNG:
89 50 4E 47 0D 0A 1A 0A— raw Base64 begins withiVBORw0KGgo - JPEG:
FF D8 FF— Base64 begins with/9j/ - GIF:
GIF87aorGIF89a—R0lGOD - WebP:
RIFFfollowed byWEBPat byte 8 —UklGR - BMP:
BM—Qk; ICO:00 00 01 00—AAABAA - AVIF: an ISO-BMFF
ftypbox with brandaviforavis - SVG: text whose first element is
<svg, optionally after an XML declaration or comments
Recognising the prefixes above is also a handy way to guess what a Base64 blob is at a glance.
Limitations
Detection covers the formats listed; TIFF, HEIC, PSD and other formats are reported as not recognised. Whether a detected format can be previewed depends on your browser — AVIF needs a recent browser, and ICO support varies — but the download always works. SVG previews are shown through an image element, so any scripts inside the SVG do not run. Inputs are limited to about 30 million characters (roughly 22 MB of image data).
Tips and common mistakes
- When copying from JSON, take the value without the surrounding quotes, and unescape
\/if your source escaped slashes. - A CSS value like
url("data:…")needs theurl(wrapper and quotes removed. - To go the other way, use Image to Base64; for non-image Base64 such as PDFs or text, use the Base64 decoder, which downloads any binary.
Frequently Asked Questions
Which image formats can this tool decode?
PNG, JPEG, GIF, WebP, BMP, ICO, AVIF and SVG. The format is detected from the decoded bytes themselves, so a raw Base64 string without a data: prefix works too.
Do I need to include the data:image/...;base64, prefix?
No. You can paste a raw Base64 string or a full data URI, including URIs with extra parameters such as data:image/svg+xml;charset=utf-8;base64,. Whitespace, line breaks and URL-safe characters are ignored or converted automatically.
Why does the tool say the data URI type does not match?
Some systems label every image as image/png even when the bytes are JPEG or WebP. The tool trusts the bytes, shows a notice, and downloads the file with the correct extension.
Why do I get "not a recognised image"?
Usually the string was cut off when copying, contains JSON escape sequences such as \n or \/, or is not an image at all (a PDF or text, for example). Copy the complete value and remove surrounding quotes.
Is my data sent to a server?
No. Decoding and preview happen entirely in your browser; the image never leaves your device.
Related tools
- Base64 Encoder/DecoderEncode and decode Base64 strings online
- JWT Decoder & ValidatorDecode JSON Web Tokens (JWT) and inspect their header, payload, claims, and expiry status.
- URL Encoder / DecoderEncode or decode URLs and query string parameters using percent-encoding (RFC 3986).
- Image to Base64Convert images to Base64 encoded strings
- HTML Entities EncoderEncode and decode HTML entities
- Base32 Encoder/DecoderEncode and decode Base32 strings online
Found a bug or a wrong result? Report it.