About this tool
Base64 to Image is the decode half of the Base64 round trip: you paste the encoded text you received from an API, an email template, a database dump or someone else codebase, and the tool reconstructs the original image file so you can save it, open it, edit it or re-upload it. It accepts both a bare Base64 string and a full data URI, strips any wrapper, decodes the payload and downloads the result as a real image file.
Encoded images appear in far more places than most people realize. Email clients embed campaign graphics as data URIs, headless tools store screenshots as Base64 inside JSON, developers paste tiny images directly into source control, and legacy systems ferry images through text-only queues. Every one of those strings is a recoverable file, and this tool exists to reverse the process without a server round trip.
Decoding follows the exact inverse of encoding. Base64 packs three bytes into four characters, so the decoder reads four characters, recovers the original 24 bits, and reassembles three bytes; the equals-sign padding tells it where the data ends. Because the mapping is lossless, a valid string always decodes to the file that was encoded, down to the last byte.
The tool does not need to know the target format in advance. After the payload is decoded, the leading bytes of the result are matched against known image signatures, so a string that decodes to a JPEG is recognized as such and offered as image/jpeg, a PNG is recognized from its PNG magic bytes, and so on across JPG, PNG, WebP, GIF, SVG, ICO and BMP. That signature check is the same technique the format and MIME checkers use, and it makes pasting from any source painless.
All of this runs locally. The pasted text is interpreted in the browser, the decoded file is offered as a download from your own machine, and nothing is transmitted anywhere. The equivalent input limit mirrors the encoder at about 25 MB of decoded binary data, which is ample for recovering practical images while keeping the page responsive. Your original file is never involved because you are neither uploading an existing file nor overwriting anything: the decoded image is delivered as a brand-new download.
The name captures the guarantee at the heart of the workflow. Encoding changes only the representation of data, never the data itself, so Base64 to Image is dependable as a verification step: decode a string you are unsure about, and if a recognizable image appears, the encoded value was valid; if it does not, the string was truncated or corrupted somewhere along the way. The same guarantee also makes the tool a dependable handoff point: whenever an API or a colleague hands you an encoded image, one paste here proves whether the asset is intact before you invest time in it.
How to use Base64 to Image
-
Paste the Base64 string or full data URI into the input area.
-
Click Decode to reconstruct the image.
-
Download the decoded image file.
What this tool does
-
Paste Base64 or full data URI.
-
Detects output format from the signature.
-
Downloads as an image file.
Specifications
| Input formats | JPG, PNG, WebP, GIF, SVG, ICO, BMP |
|---|---|
| Processing | Local browser (Canvas API) |
| Uploads | None — files stay on your device |
| Max file size | 25 MB per file |
| Original file | Never modified |
| Output formats | JPG, PNG, WebP, GIF, SVG, ICO, BMP (auto-detected) |
| Max input | Equivalent to approximately 25 MB of binary data |
| Format detection | From file signature in decoded bytes |
In-depth Guide
How the decode step recovers the original bytes
Decoding reverses the packing in strict order. Each quartet of characters is looked up in the Base64 alphabet, yielding four 6-bit values, and those values are concatenated into 24 bits which split back into three 8-bit bytes. Padding markers at the tail signal the number of partial bytes, so a string that is not a clean multiple of three bytes still ends exactly where the data ends.
Two details keep the decoder forgiving. Any whitespace the paste process introduced, such as line breaks from email wrappers or spaces from a JSON pretty-printer, is discarded before decoding, because the alphabet itself contains no whitespace values. Minor variations in a data URI prefix are also tolerated so that raw strings, strings with a MIME type, and strings with full data:image/...;base64, headers all land in the same pipeline.
- Strip any data URI prefix so only the payload remains where appropriate.
- Drop whitespace and line breaks that were added by copy-paste or transport.
- Map every four remaining characters back to their 6-bit values.
- Reassemble the 6-bit groups into the original 8-bit bytes.
- Trim to the exact length indicated by the trailing padding markers.
Format detection from file signatures
Once the bytes are recovered, the tool inspects their leading magic bytes. These short, fixed sequences are the binary fingerprint of each format: every PNG on the planet begins with the bytes 89 50 4E 47, every JPEG with FF D8 FF, and so on. Matching the decoded file against this table reveals the true format regardless of any name, MIME label or data URI prefix that did or did not accompany the string.
Signature detection is important because the prefix is not always trustworthy. A string labeled data:image/jpeg;base64, might actually contain PNG bytes if it was mislabeled when it was produced, and a raw string carries no label at all. Deriving the format from content rather than from surrounding claims gives you the same answer a conforming parser would produce.
| Format | Signature the decoder looks for | Typical MIME type provided |
|---|---|---|
| PNG | 89 50 4E 47 | image/png |
| JPEG | FF D8 FF | image/jpeg |
| GIF | 47 49 46 38 | image/gif |
| WebP | 52 49 46 46 ... 57 45 42 50 | image/webp |
| BMP | 42 4D | image/bmp |
| ICO | 00 00 01 00 | image/x-icon |
Handling messy or partial input
The most common decode failures are not encoding problems; they are transport problems. A string wrapped across lines by an email client is normal and handled, but a string truncated at an arbitrary character is not recoverable, because half of a 6-bit group carries no meaning. Similarly, a string that lost one or two characters near a line break still decodes into bytes, but they will be shifted and almost certainly produce a file that fails the signature check.
When the recovered bytes do not match a known image signature, the download is still offered but the format is unknown, which is the tool honest way of reporting that the input was plausible Base64 yet not a recognizable image. The usual fixes are to copy the complete string, confirm nothing was dropped at either end, and verify that the source used Base64 encoding rather than a different scheme such as percent-encoding or hexadecimal.
A valid Base64 string plus a byte-length that is correct always yields a file that both opens and matches its signature. If you see a recognized format come out of a string you doubted, the decode has proven the string intact.
| What you pasted | What the decoder does | What you get back |
|---|---|---|
| Full data URI with prefix | Strips the prefix, decodes the payload | A file in its real detected format |
| Raw Base64 string | Decodes the payload as-is | A file in its real detected format |
| String wrapped by line breaks | Discards the whitespace, then decodes | A file in its real detected format |
| Truncated string | Decodes shifted, incomplete bytes | An unrecognized or broken file |
| Non-image text encoded as Base64 | Decodes the raw bytes | Bytes that fail the image signature check |
Round-trip fidelity and when to trust the result
Base64 is deterministic in both directions: the same bytes always encode to the same string, and that string always decodes back to the same bytes. That determinism is what makes the round trip a useful trust check. You can encode a reference file with the Image to Base64 tool, compare the string, then decode it again here and confirm the two files match byte for byte.
What the round trip cannot do is invent data that was never there. If the original file was already compressed or lossy, the recovered file carries those same limitations, because decoding restores the bytes as they were, not an improved version. If the string originally came from a re-encoded image, the decoded file is the re-encoded image, not some earlier higher-quality version.
- Use a decode to verify an encode: a recognized image out of the tool confirms the string in question is complete and valid.
- Compare file sizes and signatures when confirming two copies are identical.
- Remember the decoded output is a new download and never touches or overwrites any existing file on your device.
- If the recovered file is a bitmap or oversized JPEG, run it through a converter or compressor rather than re-encoding a text pipeline.
Practical workflows for the decode step
Pull an image out of a fetched API response: many image endpoints return Base64 instead of binary, so pasting the field value here recovers the actual picture for review or reuse. Extract a graphic from email HTML by selecting the data URI inside an img tag and pasting it; the prefix is accepted as-is. Recover an asset committed to source control as an encoded constant when you need the editable original.
Each of these workflows shares one habit worth adopting: keep the decoded file named descriptively and organize it next to the code or template that produced the string, so the source of the encoded bytes is never a mystery later.
- Copy the complete value including, when present, the full data:image/...;base64, prefix.
- Paste it into the decoder and let the signature check determine the output format.
- Download the file, confirm it opens, and verify it against the original when one exists.
- Rename the download to something meaningful before storing or committing it.
How it works
Base64 decoding
The tool strips any data URI prefix, then reverses the Base64 encoding to recover the original binary bytes. Each 4 Base64 characters decode back into 3 bytes of the original file.
Signature-based format detection
After decoding, the tool inspects the leading bytes of the output to determine the image format. This means you do not need to specify the target format - it is derived from the data itself.
Example result
| Before | After |
|---|---|
| Input: data:image/png;base64,iVBOR... (6,400 characters) | — |
| Decoded size: 4,800 bytes | — |
| — | Detected format: PNG (from magic bytes 89 50 4E 47) |
| — | Download: Single image file, ready to use |
The decoded file matches the original that was encoded. The example shows a typical round-trip.
Pro tips
Copy the whole string, not a preview
Email wrappers and editors often truncate long values visually. Select from the very first friendly character of the payload to the final padding equals sign so nothing goes missing.
Let the signature do the naming
You do not need to know the format before pasting. After the tool detects JPEG, PNG or another signature, name the downloaded file with the correct extension rather than guessing from the source.
Strip the wrapper only where needed
Pasting the full data URI works without manual removal. Only strip a prefix yourself if you are moving the payload into a script that does not expect one.
Validate before you trust a foreign string
A string from an untrusted source that decodes into a recognizable image is a valid Base64 image; if you need to inspect what the bytes are actually safe for, treat the recovered file like any other download.
Watch for off-by-character truncation
Losing a single character downstream shifts the entire payload. A decoded file with an unknown format almost always means the copied string lost or gained a character.
Pair with the counterpart tool for verification
For a quick sanity check, re-encode the decoded file and compare the string to the source; identical strings mean a perfect round trip.
When to use it
Great for Base64 to Image
- Recovering an image from a Base64 string returned by an API or webhook.
- Extracting an embedded image from an HTML source or email template.
- Converting a data URI found in CSS back to a standalone file for editing.
- Verifying that a Base64 string decodes to a valid image and not corrupted data.
Watch out for
- If you want to encode an image to Base64 instead, use the Image to Base64 tool.
- If you need a data URI with a specific MIME type prefix, use the Data URI Generator tool.
Privacy
All decoding happens in the browser. The decoded file is downloaded directly to your device and never sent anywhere.
Edits never overwrite your original file. Every result is a new download, so you always keep the source image. Read the privacy policy.
Troubleshooting
The tool detects the format from the byte signature, not the filename. If you pasted data without a recognizable signature, the output may be an unrecognized binary blob.
Ensure the full data URI is pasted, including the data: prefix. Truncated or partially copied strings will fail to decode.
Yes. Base64 is a lossless encoding. A correct decode restores every byte of the original file.
Frequently asked questions
The tool strips whitespace before decoding. Line breaks and spaces commonly introduced by copy-paste will not cause errors.
The tool expects image data. If the decoded bytes do not match a recognized image signature, the download may produce a file with an unknown format.
No. The format is derived from the decoded bytes themselves, using the leading signature of the file. Simply paste the string and the correct format is detected automatically.
Characters outside the Base64 alphabet are ignored or rejected depending on form, and a string that decodes to bytes without a matching image signature produces a file of unknown format. Truncated strings are the most common cause of that result.
It decodes any Base64 payload it is given, but the signature check only recognizes image formats. Non-image data will decode into bytes and then fail to match a known image signature, so it is surfaced as an unrecognized file.
For any valid, untruncated Base64 string, yes. The mapping is lossless and deterministic, so the recovered bytes are exactly the bytes that were encoded.
No. Decoding happens entirely in the browser and the result is delivered as a local download. There is no upload step and no service that receives the payload.
The limit corresponds to roughly 25 MB of binary output because decoding that much data, and holding the equivalent 33 MB text string in memory, is the practical ceiling for a fast, reliable in-browser process on typical devices.
Technical details
| Base64 alphabet | A-Z, a-z, 0-9, +, / with = padding |
|---|---|
| Decoding ratio | 4 Base64 characters decode to 3 binary bytes |
| Format detection | Magic-byte signature inspection after decode |
| Whitespace handling | Stripped before decoding |
Tool last updated: September 2026. Browse all image tools.