Base64 to File, Decode and Download Any File
Paste a Base64 string or data URI and download it as a real file. Detects PDF, PNG, JPEG, ZIP, DOCX and more automatically. Runs entirely in your browser.
Loading Base64 to File, Decode and Download Any File… If nothing happens, please enable JavaScript.
Base64 is how binary files travel through text-only channels. An API returns a PDF invoice as a long string, a database column stores an avatar as characters, a log line contains an attachment, a data URI embeds an icon in a stylesheet. At some point you need the file back, and a decoder that only prints text is useless: a decoded PNG shown as text is unreadable mojibake. This tool takes the Base64 and hands you the actual file, named and typed correctly, ready to open.
Frequently asked questions
Is my Base64 data uploaded to a server?
How does the tool know the file type and extension?
Can I paste a full data URI?
What if the detected type is wrong?
Does it handle Base64url from a JWT?
Why do I get an unexpected character error?
Is there a size limit?
The preview is blank but the download works. Why?
Can it decode a Base64 string that is actually just text?
Why does the downloaded file open with the wrong application?
About Base64 to File, Decode and Download Any File
Paste the string and the decoding happens as you type. You can paste a bare Base64 payload or a complete data URI such as data:application/pdf;base64,JVBERi0xLjQK, in which case the declared MIME type and any name parameter are picked up automatically. Line breaks, indentation, surrounding quotes and trailing commas left over from copying out of JSON or a code editor are stripped for you. Base64url, the URL-safe variant that uses - and _ instead of + and /, is accepted too, which matters because that is what JSON Web Tokens and many APIs produce, and missing padding is restored rather than treated as an error.
The interesting part is working out what the bytes actually are. The tool reads the file's magic number, the short signature at the start of almost every binary format, and recognises PDF, PNG, JPEG, GIF, WebP, BMP, ICO, TIFF, SVG, MP3, WAV, OGG, FLAC, MP4, WebM, ZIP, GZIP, RAR, 7z, WOFF and TrueType fonts, SQLite databases and Windows executables. ZIP containers are inspected one level deeper, so a DOCX, XLSX, PPTX or OpenDocument file is identified as such instead of a generic archive. When the content turns out to be valid UTF-8 text, it is classified further into JSON, XML, HTML, PEM or plain text. The suggested filename, extension and MIME type follow from that detection, and all three remain editable if you know better than the sniffer does.
Before downloading you can see what you decoded. Images, PDFs, audio and video are previewed inline, and text formats are shown as text, which is usually enough to confirm you pasted the right string. Everything runs locally: the decoding, the type detection and the preview all happen in your browser using atob and the File API, and the file is produced from an in-memory blob. Nothing is uploaded, which is what makes it safe for signed documents, private keys, medical records and anything else you would not paste into a server-side converter.
The 33 % Tax Everyone Agreed to Pay
Base64 exists because the early internet could not be trusted with the number 8. Many mail systems in the 1970s and 1980s were built on 7-bit ASCII, and some deliberately stripped the eighth bit or mangled control characters. Any byte above 127 could be silently destroyed in transit, which made sending a program or an image through email impossible. The workaround, formalised in RFC 989 in 1987 and refined in the MIME specifications of 1992, was to stop fighting the pipe: re-encode the data using only characters every system already handled safely, and accept the cost of doing so.
That cost is exactly 33 %, because 3 bytes of input (24 bits) become 4 characters of output (6 bits each). It is a strange bargain, paying a third more bandwidth for the privilege of using a dumber channel, and it was supposed to be temporary. Instead Base64 outlived the problem it solved. Modern email is 8-bit clean, yet attachments are still Base64 encoded, because by the time the transport improved, every mail client on earth had been built around the assumption.
The idea then spread far beyond email. Data URIs put Base64 images directly into HTML and CSS. JSON has no binary type, so every API that returns a file returns Base64. JWTs, TLS certificates in PEM form, SSH keys, PGP messages and Kubernetes secrets are all Base64 wrapped. That last one causes a recurring misunderstanding worth repeating: Base64 is not encryption. A Kubernetes secret stored as Base64 is readable by anyone who can run a decoder, which is to say anyone at all. Encoding hides data from a transport layer, not from a person.