How to use
- Paste a Base64 string or a data URI such as
data:image/png;base64,…into the box. - A whole CSS
url("…"), HTML<img src="…">or JSON string works too — only the data URI part is read. Line breaks, spaces and escapes like\nare removed automatically. - Check the preview and the detected format, then click Save. The file extension matches the real data format.
Decoding happens in your browser; nothing you paste is sent to a server.
How the format is detected
The image/png label in a data URI can be wrong, so this tool looks at the first bytes of the decoded data (the file signature) to identify the real format. You can often tell the format from the start of the Base64 string alone.
| Format | File signature | Base64 starts with |
|---|---|---|
| PNG | 89 50 4E 47 0D 0A 1A 0A |
iVBORw0KGgo |
| JPEG | FF D8 FF |
/9j/ |
| GIF | GIF87a / GIF89a |
R0lGOD |
| WebP | RIFF … WEBP |
UklGR |
| SVG | <svg or <?xml |
PHN2Zy / PD94bWw |
| ICO | 00 00 01 00 |
AAABAA |
| PDF (not an image) | %PDF |
JVBERi |
AVIF, HEIC, TIFF, BMP and JPEG XL are detected as well. Formats the browser cannot display, such as HEIC or TIFF, can be saved but not previewed.
Example
The sample loaded on first visit is a 16×16 pixel PNG: 120 bytes as a file, 160 characters in Base64. Since Base64 turns 3 bytes into 4 characters, characters × 3 ÷ 4 gives a quick estimate of the file size.
When something goes wrong
- Invalid characters: Base64 only uses A–Z, a–z, 0–9,
+,/and trailing=. The tool tells you which character is the problem so you can remove anything that slipped in while copying. - Invalid length: usually the end of the string was cut off — copy it again from the source. A missing trailing
=is fixed automatically. - URL-safe Base64: the variant using
-and_(common in JWTs) is converted to standard Base64 for you.
FAQ
What if the data URI type and the detected format disagree?
The label in the data URI is wrong (for example, PNG data labelled image/jpeg). The file is saved with the extension of the real format.
Is it safe to save an SVG?
The preview is rendered as an image, so scripts never run. If the SVG contains scripts, you will see a warning — do not open untrusted SVG files directly in a browser.
How do I go the other way?
Use Image to Base64. For Base64 of plain text, use the Base64 encoder/decoder.