What Is a Base64 to Image Decoder?
A Base64 to image decoder converts a Base64-encoded text string back into the original image file. Base64 is a way of representing binary data, such as a PNG or JPG, using only letters, digits, + and /, so it can travel safely inside text formats like HTML, CSS, JSON, XML and email. You often find Base64 images as data URIs starting with data:image/png;base64,, in API responses, in database fields, in log files and in the source code of web pages.
This free decoder shows you what the string contains and lets you save it as a normal image file. It reads the first bytes of the decoded data to identify the true file type (PNG, JPG, GIF, WebP, SVG, BMP, ICO, AVIF, TIFF or even PDF), so you get the correct extension even when the string has no header or the declared type is wrong.
How to Convert Base64 to an Image
- Paste your Base64 into the box: a full data URI, the raw Base64 part, or a chunk of HTML/CSS/JSON.
- See the preview appear instantly, with the detected format, file size and dimensions.
- Set a file name if you like.
- Download the image, or download all images as a ZIP if several were found.
Supported Input
| Input | Example |
|---|---|
| Data URI | data:image/jpeg;base64,/9j/4AAQ... |
| Raw Base64 | iVBORw0KGgoAAAANSUhEUg... |
| URL-safe Base64 | Uses - and _ instead of + and / |
| Wrapped lines | Line breaks and spaces (as in MIME email) are ignored |
| HTML, CSS, JSON, Markdown | All embedded data URIs are found and decoded |
Features
- Automatic type detectionIdentifies the real format from the file signature.
- Instant previewSee the image as soon as you paste.
- Extract all imagesPull every data URI out of a web page, stylesheet or JSON file.
- Forgiving parserHandles missing padding, URL-safe characters, quotes and line breaks.
- Mismatch warningFlags when the declared MIME type doesn't match the actual data.
- PrivateDecoding runs in your browser, so nothing is uploaded.
Troubleshooting
- "Not valid Base64": the string contains characters outside the Base64 alphabet. Make sure you copied only the encoded part, without surrounding code.
- Nothing decodes: the string may be truncated. Very long strings are sometimes cut off when copied from consoles or logs.
- Image won't display: the data may be a format your browser can't show (such as TIFF). You can still download the file and open it in an image viewer.
Where You'll Find Base64 Images
- Web page source code: small icons, logos and placeholders embedded in HTML or CSS.
- API responses: many APIs return images, signatures, QR codes and charts as Base64 fields in JSON.
- Databases and exports: images stored in text columns or included in CSV and XML exports.
- Emails: MIME messages encode attachments and inline images in Base64 with line breaks every 76 characters.
- Canvas and screenshots in web apps:
canvas.toDataURL()produces a PNG data URI. - Logs and debugging output: developers often log image data when troubleshooting uploads.
Whatever the source, paste the text here and the decoder isolates the Base64 data, fixes common copy-and-paste problems such as missing padding or escaped characters, and shows you the result. For security, decoded images are displayed from local blob URLs and never sent anywhere. SVG images are shown inside an image element, which prevents any embedded scripts from running.
Tip: if you need to go the other way, turning a picture into a data URI for your own HTML, CSS or JSON, the companion Image to Base64 tool offers six output formats and can shrink the image before encoding. Both tools work offline once the page has loaded.
Frequently Asked Questions
Why does my Base64 string decode to a broken image?
Usually the string was cut off when copying. Compare its length with the source, or copy it again from the original file or response.
How do I know what type of image a Base64 string is?
Paste it here. The decoder reads the file signature and shows the exact format, such as PNG, JPEG or WebP.
Do I need the "data:image/...;base64," prefix?
No. Raw Base64 works too, and the file type is detected automatically.
Can I decode several images at once?
Yes. Paste HTML, CSS or JSON containing multiple data URIs, or load a text file, and every image is extracted.
How do I convert an image to Base64?
Use the Image to Base64 converter.
Is my data uploaded?
No. Everything is decoded locally in your browser.