Free Base64 to Image Decoder
Paste any Base64 string or data URI — the tool auto-detects the format, previews the image, and lets you download it as PNG, JPG, WebP or BMP. All in your browser.
Your Base64
data:image/…;base64, prefix are all handled automatically. Just paste whatever you have.Decoded Image
No image decoded yet
Paste Base64 in the left panel to see the previewWhat Is Base64?
Base64 is a method of encoding binary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, + and /. It exists because many text-based systems (HTML, CSS, JSON, XML, email) can't safely carry raw binary data — but they handle text just fine.
When you see a long string like iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==, you're looking at an encoded image. This tool decodes it back into a real image file you can preview and download.
The two forms of Base64 input
| Form | Example | Where you see it |
|---|---|---|
| Data URI | data:image/png;base64,iVBOR… |
HTML src attributes, CSS url(), JSON APIs |
| Raw Base64 | iVBORw0KGgoAAAA… |
API responses, database fields, log files |
| Base64url | iVBORw0KGgoAAAA… with - and _ |
JWT tokens, URL query strings |
This tool accepts all three. The prefix (or lack of one) doesn't matter — the format is detected from the decoded data itself.
Why magic bytes beat prefixes
Many decoders trust the MIME type declared in the data URI prefix — data:image/png;base64,…. This is unreliable: developers frequently copy-paste the wrong prefix, or omit it entirely when sending raw Base64 through an API.
This tool uses magic bytes instead — it reads the first few bytes of the decoded data and matches them against known signatures:
| Format | Magic bytes |
|---|---|
| PNG | 89 50 4E 47 0D 0A 1A 0A |
| JPEG | FF D8 FF |
| GIF | 47 49 46 38 ("GIF8") |
| BMP | 42 4D ("BM") |
| WebP | 52 49 46 46 … 57 45 42 50 ("RIFF"…"WEBP") |
| ICO | 00 00 01 00 |
| SVG | Text starting with <svg or <?xml |
This is how operating systems and browsers identify files too, so it's the most reliable approach.
Common reasons a Base64 string fails to decode
- Truncated input. Copy-paste from a log or chat window often drops the last few characters. The length must be a multiple of 4 (after stripping whitespace and padding).
- Wrong character set. Base64url uses
-and_instead of+and/. This tool converts automatically. - Extra wrappers. Values copied from CSS often look like
url('data:image/png;base64,…'). Theurl()and quotes are handled by this tool. - Line breaks. Whitespace inside the string is legal but some tools choke on it. This tool strips all whitespace before decoding.
- URL-encoded data URI. Rare, but some SVGs use
data:image/svg+xml,%3Csvg…— this is not Base64 at all, it's URL-encoded. This tool detects and handles that case too. - Not Base64 at all. If the input contains arbitrary text, the tool will show a clear error rather than a garbage image.
About output formats
You can download the decoded image in five formats:
- Original — keeps the detected format. Decoded bytes are written as-is: byte-for-byte identical to what was encoded. Best choice when you just want the image back.
- PNG — lossless re-encoding. Preserves transparency. Good for converting a JPEG to PNG, or extracting a still frame from an animated GIF.
- JPG — lossy re-encoding with adjustable quality. Transparency is filled with a background colour you choose.
- WebP — modern format with adjustable quality. Supports transparency. Usually 25–35% smaller than JPEG at the same visual quality.
- BMP — uncompressed. Only useful when a legacy app or print workflow demands it.
Common use cases
Recover Embedded Images
Extract images from API responses, log files or database dumps.
Debug Base64 APIs
Quickly verify that a Base64 payload is a valid image.
Convert Inline CSS
Pull images out of CSS url() data URIs back into files.
Security Analysis
Inspect suspicious Base64 strings before trusting them.
Extract Icons
Recover icons and favicons that were embedded as data URIs.
Database Migration
Export images stored as Base64 text fields into real image files.
Git Cleanup
Decode Base64 blobs committed into source files back into assets.
Format Conversion
Turn Base64 PNGs into JPGs for compatibility with older systems.
Privacy and security
This Base64 to image decoder runs entirely in your browser. The decoding uses the standard atob function, the preview uses a blob URL, and any re-encoding uses the Canvas API. Nothing is uploaded, stored or transmitted. Safe for confidential assets, client work and API debugging with sensitive tokens.
Frequently Asked Questions
How do I convert Base64 to an image?
What is the difference between a data URI and raw Base64?
data:image/png;base64, followed by the encoded data. Raw Base64 is just the encoded string with no prefix. This tool accepts both — paste whichever you have.Why does my Base64 string not decode?
Does decoding affect image quality?
How does the tool detect the image format?
89 50 4E 47, JPEG with FF D8 FF, GIF with 47 49 46 38, and so on. This is more reliable than trusting the prefix in a data URI, because prefixes are often wrong or missing.Can I convert Base64 to PNG, JPG or WebP?
What if the Base64 is an SVG?
<svg or <?xml tag in the decoded text. Downloading in Original format gives you the .svg file. Converting to PNG/JPG/WebP/BMP renders the SVG to a raster image using the browser's SVG renderer.What if the Base64 is an animated GIF?
Is my data sent to a server?
atob function and Canvas API. Your Base64 data never leaves your device — nothing is uploaded, stored or transmitted.