Base64 to File
Decode a Base64 string back into a real downloadable file — free, instant, nothing uploaded
Paste Base64 or a Data URI
We Work Out What It Is, Then Hand You the File
Someone sends you a wall of characters with no explanation. Is it a PDF? A zip? You paste it into a decoder and get "invalid input" with no clue why. This Base64 to file tool reads the bytes and tells you.
No data: header needed. Paste, decode, download — with the right extension already applied.
How to Decode Base64 to a File
- Paste the string. Bare Base64, a Data URI, or base64url all work.
- Glance at the counter. It warns you if characters went missing.
- Click Decode to File. The green bar names the format it found.
- Read any warnings. A MIME mismatch usually means a bug upstream.
- Click Save. The extension matches the detected type.
That counter earns its place. Most failures we see are truncation, not corruption — someone copied from a terminal that clipped the output.
Why Byte-Level Detection Beats Prefix Matching
Most decoders guess the format from the first few characters of the Base64 text. That works until two formats share an opening.
WebP, WAV, and AVI are all RIFF containers. Their first four bytes are identical, so their Base64 prefixes are identical too. A prefix matcher cannot separate them and will confidently hand you a .webp that is really an audio file.
We decode the first 64 bytes instead and read the actual header. For RIFF files the subtype sits at byte 8 — WEBP, WAVE, or AVI — which settles it.
The same trick separates the ZIP family. DOCX, XLSX, PPTX, EPUB and JAR are all ZIP archives, so we look for a word/ or xl/ marker inside the header to name them.
Honest limit: if that marker sits past the first 64 bytes, you get ZIP. Rename the file and it opens perfectly.
Turning Base64 to PDF and Other Documents
PDFs are what most people bring here. They start with %PDF, which encodes to JVBERi0, so identification is instant and certain.
If the download opens to a blank page, the string was double encoded. Someone encoded text that was already Base64. Run the result through again and the real PDF appears.
For Office documents, expect DOCX and XLSX to be recognised by their internal folder markers. Legacy .doc and .xls files use a different container entirely and are detected separately.
Going the other way? The file to Base64 encoder handles any type and fills in the MIME header for you.
Handling base64url From JWTs and URLs
Standard Base64 uses + and /. Both break inside a URL, so a variant called base64url swaps them for - and _ and usually drops the = padding.
You will meet it in JWTs, OAuth flows, and signed query strings. Paste one into a standard decoder and it fails with no useful message.
We detect the variant and swap the characters back before decoding, then say so in the result bar. It costs nothing and removes a genuinely confusing failure.
Decoding a whole token, though? Use the JWT decoder — it splits the three segments and formats the claims properly.
A Security Note Worth Reading
Base64 is a favourite technique for smuggling executables past email filters and content scanners. Attackers encode a payload, the filter sees harmless text, and the recipient decodes it themselves.
So treat a decoded file the way you would treat any unknown download. Never run a decoded executable from a string you did not create.
Your antivirus flagging a decoded file is doing its job, not misbehaving. We would investigate rather than override it.
On the privacy side, decoding runs entirely in your browser. Nothing is uploaded, so pasting a confidential document here is safe from our end.
When You Want Text or an Image Instead
Three sibling tools cover the cases this page is not built for:
- Plain text with emoji or non-Latin scripts — the Base64 encoder and decoder.
- An image you want to preview before saving — the Base64 image decoder.
- Producing a Data URI for CSS or HTML — the image to Base64 tool.
This page exists for everything else: the documents, archives, fonts, and media that image-only converters refuse.
Frequently Asked Questions
How can you tell the file type when the string has no data: header?
+
Why is WebP so often mistaken for a WAV file by other tools?
+
My DOCX downloads as a ZIP. Is that a bug?
+
My string has dashes and underscores. Will it still decode?
+
What does the truncation warning actually mean?
+
My PDF downloads fine but opens as a blank page. Why?
+
Can I use this to read a JWT payload?
+
The downloaded file has the wrong extension. Can I fix it?
+
My antivirus flagged the downloaded file. Should I worry?
+
Is there a size limit on what I can decode?
+
The Short Version
Paste, decode, save. Turning Base64 to file works here without a header, because we read the real bytes rather than guessing from the text.
Check the warnings before you blame the string. Truncation and double encoding explain nearly every failure.
Related Tools You Might Like
Case Converter
Convert text between UPPERCASE, lowercase, Title Case, and more
Password Generator
Generate secure, random passwords with custom options
Word Counter
Count words, characters, paragraphs, and reading time
Base64 Encoder & Decoder
Encode and decode Base64 for text, files, and images with Data URI output
File to Base64
Encode any file type to Base64 or a Data URI, with the MIME type filled in
Regex Tester
Test and validate regular expressions with live preview
