Base64 to Image Decoder
Decode a Base64 string or data URI to an image, detect PNG, JPEG, GIF, WebP, SVG or ICO from its bytes, preview it and download the file.
Runs entirely in your browser. Your data is never uploaded.
What is Base64 to Image?
Paste a Base64-encoded image, with or without the data:image/...;base64, prefix, and this tool decodes it, detects the real image type from the decoded bytes, shows a preview with its dimensions and file size, and lets you download it with the correct file extension.
How to use Base64 to Image
- Paste a data URI or a raw Base64 string into the input box (line breaks and spaces are ignored).
- Check the Detected type, dimensions and size, and the preview.
- Click the download button to save the file, for example
decoded-image.png.
Example
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAIAAAC0Ujn1AAAAKklEQVR4nGM0TjvDQBvARCNzR40eNXrU6FGjR40eNXrU6FGjR40eEUYDACc1AaFANYRxAAAAAElFTkSuQmCC
Detected type: PNG (image/png), 30×30 px, 99 B – a solid #3366CC square
When to use Base64 to Image
Use it to inspect images embedded in HTML, CSS, JSON API responses, logs or emails, or to recover a file someone sent as Base64. It cannot fix truncated strings: if part of the Base64 is missing the image will be invalid.
How Base64 to Image works
The tool strips the data URI prefix, removes whitespace, accepts URL-safe Base64 (- and _) and missing = padding, then decodes with atob. The bytes are identified by their signature: PNG, JPEG, GIF, WebP, AVIF, HEIC, BMP, ICO, TIFF or SVG text. If the data URI declares a different MIME type than the bytes, a warning is shown. The preview uses an object URL of the decoded bytes.
Common Use Cases
- Viewing an image returned as Base64 by a REST API.
- Extracting an inline image from an HTML email or CSS file.
- Checking whether a data URI really contains the format it claims.
- Saving a Base64 screenshot from a test log as a PNG file.
Security Note
Images are decoded, processed and encoded locally in your browser with the Canvas API. Nothing is uploaded to a server. SVG content is shown only inside an <img> element, where scripts in the SVG do not run.
FAQs
Do I need the data:image prefix?
No. Raw Base64 works too; the type is detected from the decoded bytes.
Why do I get “not valid Base64”?
The string contains characters outside the Base64 alphabet or has an impossible length, usually because it was cut off or contains quotes or escape sequences. Paste only the Base64 part.
What if the data is not an image?
The tool tells you the Base64 decodes correctly but is not a recognized image format, and does not offer a misleading preview.