Base64 to Image or File
Decode Base64 or a data URI back to a file: the type is detected from its first bytes, images are previewed and the file can be saved.
Free · No sign-up · Your inputs stay in your browser
Input
Decode Base64 to a file
Output
image/png, 107 B
| Detected type | image/png |
|---|---|
| First bytes | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Magic numbers
Most file formats start with a fixed signature: PNG with the bytes 89 50 4E 47, JPEG with FF D8 FF, PDF with %PDF and ZIP with PK. Checking them is how file on Linux and PHP's finfo identify a file regardless of its name, and it is how an upload handler should check what it was sent.
Where Base64 files come from
APIs return generated PDFs and images as Base64 inside JSON, email attachments are Base64 in the raw message, and canvas exports arrive as data URIs. Decoding one by hand is the quickest way to see whether the data or the code that handles it is broken.