How to turn Base64 into an image
- Paste the Base64 string or the whole
data:image/...;base64,URI into the left box. A small sample PNG is already loaded so you can see how it works. - Check the preview that appears under the tool. The status line tells you which format was found and how large the file is.
- Click Download to save it. The file gets the matching extension:
.png,.jpg,.gifor.webp.
How the format is detected
Every common image format starts with a fixed byte signature. After decoding, the tool looks at the first bytes:
| Starts with (hex) | Base64 often starts with | Format |
|---|---|---|
89 50 4E 47 |
iVBORw0KGgo |
PNG |
FF D8 FF |
/9j/ |
JPEG |
47 49 46 38 |
R0lGOD |
GIF |
52 49 46 46 … 57 45 42 50 |
UklGR |
WebP |
So you can often tell what an encoded image is just by its first characters: iVBOR is almost always a PNG and /9j/ a JPEG.
Fixing a Base64 image that will not decode
- Invalid Base64 error: the string was probably cut off. Very long strings are often truncated by chat apps and log viewers; copy it from the original source.
- Extra characters: remove surrounding quotes, a trailing comma, or JSON escapes such as
\/. Spaces and line breaks are ignored automatically. - Decodes but no preview: the data may be an SVG (text, shown in the output box), an ICO or another format. Download it and open it in an image viewer.
To go the other way, use image to Base64. For Base64 that holds text, use the Base64 decoder.
When to switch back to a normal image file
A data URI is handy for a small image you want to keep inside one file, but it has real costs as the image grows. Base64 text is about 33% larger than the image it holds, so a 300 KB photo becomes roughly 400 KB of text. That text sits inside your HTML, CSS or JSON, so it must be downloaded before the rest of the document can be used, and it is downloaded again every time that document changes.
A separate image file avoids both problems. The browser can cache it on its own and reuse it across pages, and it can start loading it in parallel with everything else. With HTTP/2 and HTTP/3, many small image requests share one connection, so the old reason for inlining icons (saving round trips) matters much less than it used to.
A practical rule: keep data URIs for images under a few kilobytes, such as icons, tiny placeholders, or images in a single-file HTML report or an email signature. For anything larger, decode it here, download the file, and reference it with a normal URL. If you received a long Base64 string from an API, saving it as a file this way is also the quickest way to check what it actually contains.