How to convert Base64 to an image
- Paste the Base64 string into the box above. A full data URI such as
data:image/png;base64,iVBOR...works, and so does the bare string without the prefix. - The decoder reads the first bytes of the result and labels it: PNG image, JPEG image, GIF image, WebP image or SVG image. The Preview tab opens on its own and shows the picture.
- Click Download file to save it. The file gets the right extension, such as
decoded.pngordecoded.jpg, based on the bytes, not on a guess.
Nothing is uploaded. The image is rebuilt in your browser, so screenshots, scans and private photos stay on your device.
How to tell which image format a Base64 string holds
You can often recognise the format from the first few characters, because every image format starts with a fixed signature:
| Base64 starts with | Format | First bytes |
|---|---|---|
iVBORw0KGgo |
PNG | 89 50 4E 47 |
/9j/ |
JPEG | FF D8 FF |
R0lGOD |
GIF | 47 49 46 38 |
UklGR |
WebP (RIFF container) | 52 49 46 46 |
PHN2Zy or PD94bWw |
SVG (text: <svg or <?xml) |
3C 73 76 67 |
The data:image/... prefix in a data URI also names the type, but it can be wrong if someone typed it by hand. This tool trusts the bytes.
Where Base64 images come from
- HTML and CSS that embed small icons as
<img src="data:image/png;base64,...">orbackground: url(data:...), so the page needs no extra request. - API responses that return a screenshot, a QR code, a signature or a generated chart as a Base64 field in JSON.
- Email source, where attached and inline images are stored as Base64 blocks between MIME boundaries.
- Canvas exports from
canvas.toDataURL()in JavaScript.
Why a Base64 image will not display
It is not an image. If the label says Text, JSON or Binary data, the string holds something else. Check the Text or Hex tab to see what it really is.
The string was cut off. Base64 images are long, and copying from logs or terminals often truncates them. The preview may show only the top part of the picture, or nothing. Copy the full value again.
Extra characters crept in. Quotes, a trailing comma from JSON or escaped \n sequences break the data. Remove them, or turn on Strict mode to see where the first bad character is.
Line breaks. Email and PEM-style Base64 is wrapped at 76 characters. That is fine: line breaks and spaces are ignored here.
Base64 image size
Base64 makes data about 33% larger: every 3 bytes become 4 characters. A 30 KB PNG becomes roughly 40 KB of text. After decoding, the info line under the result shows the real size in bytes, so you can see how big the image file will be.
Need the reverse, or a PDF instead? See Base64 to PDF or use the main Base64 decoder for any other data.
Last updated: