Decode Base64 to an image and download it
Base64-encoded images turn up everywhere: inside HTML src attributes and CSS files, in JSON responses from APIs, in database exports, in email source code and in the output of a canvas toDataURL() call. The Base64 to Image converter turns that wall of characters back into a picture you can see, check and save.
Paste a full data URI or just the Base64 text. The decoder ignores line breaks, spaces, quotes and the surrounding HTML, CSS or Markdown, works out the real file type from the decoded bytes, shows the dimensions and size, and downloads the file with the correct extension. When something is wrong, it tells you exactly what — an invalid character, a missing piece, or data that is not an image at all. Decoding happens in your browser, so sensitive data never leaves your device.
How to use the Base64 to Image
- Paste your Base64 string or data URI into the box — the decoder runs as soon as you stop typing. Press “Try an example” to see how it works.
- Look at the preview and the details: detected type, pixel dimensions, decoded size and Base64 length.
- Read any notes, for example when the data URI claims a different type than the data really is, or when the string looks cut off.
- Optionally change the file name, then press the download button. The extension is chosen from the detected type.
Base64 to Image features
Forgiving input
Accepts raw Base64, data URIs, URL-safe Base64, JSON-escaped strings and snippets copied from HTML, CSS or Markdown.
Real type detection
Reads the file signature to recognise PNG, JPEG, GIF, WebP, BMP, ICO, SVG, AVIF, HEIC, TIFF and PDF — even if the label is wrong.
Clear error messages
Points to the invalid character, missing data or wrong length, and recognises text, ZIP and PDF data that is not a picture.
Truncation check
Warns when a PNG, JPEG or GIF is missing its end marker, the usual sign of a string that was not copied completely.
Correct file extension
Downloads as .png, .jpg, .gif, .webp, .svg, .ico and so on, with a file name you can edit.
Private decoding
Everything runs locally with the browser’s own Base64 decoder; nothing is uploaded or logged.
Recognise an image type from its first Base64 characters
Every file format starts with a fixed signature, so its Base64 text starts with fixed characters too. That lets you identify a string at a glance — and spot a data URI whose MIME type does not match its content.
| Base64 starts with | File type | Signature bytes |
|---|---|---|
iVBORw0KGgo | PNG | 89 50 4E 47 0D 0A 1A 0A |
/9j/ | JPEG | FF D8 FF |
R0lGOD | GIF | GIF87a / GIF89a |
UklGR | WebP (RIFF container) | RIFF … WEBP |
Qk | BMP | BM |
AAABAA | ICO | 00 00 01 00 |
PHN2Zy or PD94bWw | SVG | <svg or <?xml |
JVBERi | PDF (not an image) |
Why a Base64 image will not decode
- It was cut off. Long strings are often truncated by log viewers, spreadsheets (Excel cells hold at most 32,767 characters) or a copy that missed the end. A truncated image may show only its top part or nothing at all.
- Plus signs became spaces. When Base64 travels in a URL query string, “+” can be turned into a space. The decoder detects this and repairs it automatically.
- Extra escaping. JSON may contain
\/and\n; percent-encoding may turn + into%2B. Both are cleaned up before decoding. - Two strings pasted together. An “=” sign in the middle of the data means one Base64 value ended and another started.
- It is not an image. Base64 can hold any file. If the result is text, a ZIP or a PDF, the tool says so instead of showing a broken picture.
Working with the decoded file
Need a different format after decoding? Convert the downloaded file to JPG, PNG or WebP with the image converter. To go the other way and turn a picture into Base64, use Image to Base64, and for decoding Base64 that contains text rather than an image, use the Base64 encoder and decoder. If the string came from an API response, the JSON formatter helps you find it in the payload.
Base64 to Image FAQ
How do I convert Base64 to an image?
Paste the Base64 text or data URI into the box on this page. The Base64 to image converter shows a preview straight away; press the download button to save it with the right extension.
Do I need the “data:image/png;base64,” prefix?
No. Raw Base64 works fine because the decoder identifies the type from the data itself. If a prefix is present, it is used only to warn you when it does not match the content.
Why does it say my Base64 is invalid?
The text contains a character that Base64 does not use, has the wrong length, or has “=” padding in the middle. The error message shows the problem character and nearby text so you can find it.
How can I tell what type of image a Base64 string is?
Look at the first characters: iVBORw0KGgo is PNG, /9j/ is JPEG, R0lGOD is GIF and UklGR is WebP. The decoder does this check for you and shows the detected type.
Can it decode a Base64 PDF?
It recognises PDF data and lets you download it as a .pdf file, but it does not render PDF pages. Use PDF to JPG to turn the pages into images.
Is my data sent anywhere?
No. Decoding uses your browser’s built-in functions and happens entirely on your device.