Base64 to image: what the decoder does
A Base64 string is the bytes of a file written as text. To get the picture back, the tool decodes the characters to bytes, finds out the image type and shows it, with a download button. You can paste a full data URI (data:image/png;base64,...) or only the part after the comma; without the prefix the type is recognised from the first bytes. Everything runs in your browser, so a private image is never sent anywhere. This page opens the tool in the Base64 to image direction, with a sample already decoded.
Worked example
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iNjAiPjxyZWN0IHdpZHRoPSIxMjAiIGhlaWdodD0iNjAiIHJ4PSI4IiBmaWxsPSIjMWMyNDMwIi8+PGNpcmNsZSBjeD0iMzAiIGN5PSIzMCIgcj0iMTgiIGZpbGw9IiNmMmI4NGUiLz48L3N2Zz4=Decoded, this is an image of type image/svg+xml with 170 bytes. For an SVG the bytes are readable text:
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="60"><rect width="120" height="60" rx="8" fill="#1c2430"/><circle cx="30" cy="30" r="18" fill="#f2b84e"/></svg>Pasting only the part after the comma gives the same result, with the type recognised from the content: image/svg+xml.
Tell the format by the first characters
Every file format starts with a fixed signature, so its Base64 starts the same way. Computed from the real signatures:
| Format | Base64 starts with | First bytes (hex) |
|---|---|---|
| PNG | iVBORw0KGgo | 89 50 4e 47 |
| JPEG | /9j/ | ff d8 ff e0 |
| GIF | R0lG | 47 49 46 38 |
| WebP | UklGR | 52 49 46 46 |
| SVG | PHN2Zy | 3c 73 76 67 |
JVBERi0 | 25 50 44 46 |
Why decoding fails
- The text is cut: a copy that lost its end gives a broken image or no image. Base64 length is a multiple of 4 (with = padding at the end).
- It is not an image: the decoded bytes may be a PDF, a ZIP or text. The tool tells you that the content is not an image instead of showing a blank box.
- Line breaks and spaces inside the text are fine, but characters such as "-" and "_" mean URL-safe Base64, which uses another alphabet than the standard "+" and "/".
How to use the decoder
- Paste the Base64 or the data URI in the box; a sample is already there.
- Check the preview, the type and the size of the image.
- Download it with the right extension (png, jpg, svg…).
Frequently asked questions
How do I convert Base64 to an image file?
Paste the Base64 (or the whole data URI) in the decoder and press download: the file gets the extension that matches its real type.
Does the Base64 need the data:image prefix?
No. With the prefix the type is read from it; without it the decoder looks at the first bytes (PNG, JPEG, GIF, WebP, BMP and SVG are recognised).
Is it safe to paste a private image here?
Yes: decoding runs in your browser and nothing is sent to a server. Be careful with SVGs from unknown sources, which can contain scripts: the preview shows the picture as an image, where scripts do not run.