Base64 to Image Converter
Paste Base64 text or a data URI and see the picture, find out what kind of file it really is, and save it with the right extension.
Results
What this tool does
Images hidden inside JSON, HTML, CSS or emails are often just Base64 text, and the label in front of them is not always right. This converter decodes the text and looks at the first bytes of the file, the signature every format starts with, so a PNG is recognised even without a data: prefix, and a JPEG mislabelled as PNG is flagged. It accepts the URL-safe variant with - and _, line breaks and missing = padding. PNG, JPEG, GIF, WebP, BMP, ICO and SVG are shown and can be saved; anything else, such as a PDF, can still be downloaded. Decoding happens on this page, so nothing is sent anywhere.
Formula
4 Base64 characters → 3 bytes ; the file type is read from the first bytes (PNG 89 50 4E 47, JPEG FF D8 FF, GIF 47 49 46, WebP RIFF…WEBP)
Variables
| Symbol | Meaning | Unit |
|---|---|---|
text | Base64 text or data URI | — |
OUT | File type found | — |
EX | Extension | — |
SZ | New file size | — |
IM | Can be shown as an image | — |
AG | Declared type matches the content | — |
Worked example
- Base64 text or data URIdata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAATElEQVR42mNgGHFALu/Ef6obSAjTzGCyLSLHcKItocRwoiyhqQXUMByvJaMW4LWAmobTxZLRSB7YzDawZRHNS1O61Ad0qdHoVidTCgCcs+Dm+ufx/gAAAABJRU5ErkJggg==
- File type foundimage/png
- Extensionpng
- New file size133 B
- Can be shown as an imageYes
- Declared type matches the contentYes
Limitations
- The calculation runs entirely in your browser. The values you type are never sent to a server.