Base64 to File Converter
Paste any Base64 string — or a data URI — and download it as a file, with the type detected automatically. Everything runs in your browser; nothing is uploaded.
How to convert Base64 to a file
Paste your data into the box above. You can give it a full data URI — a string of the form data:application/pdf;base64,JVBERi0… — or just the raw Base64 payload without the data: prefix. The tool decodes the bytes locally and sniffs the type from the leading bytes: the magic number at the start of the file that identifies PNG, JPEG, GIF, WebP, SVG, or PDF. When it's an image, you get a live preview. Then click Download file to save the result with the right extension.
What file types are detected?
The tool inspects each file's magic bytes — the signature at the very start of the data — to recognize:
- PNG, JPEG, GIF, and WebP images (these also show a live preview).
- SVG vector images.
- PDF documents.
Anything else still decodes perfectly — it just downloads as a .bin file. The bytes are exactly correct; only the extension defaults to binary because the format isn't one of the recognized signatures. If you know what it should be, rename the file after downloading.
Why won't it decode?
If you get an error or unexpected bytes, one of these is usually the cause:
- The Base64 is truncated. A partial copy cuts off the end, so the bytes don't form a complete, valid file.
- It's URL-safe Base64 without padding. That's fine here — the tool automatically converts
-and_back to+and/and re-adds the missing=padding before decoding. - A copy/paste added stray characters. Line breaks and spaces are stripped automatically, but quotes, HTML entities, or a stray prefix can corrupt the payload.
Tip: if you only have a snippet, make sure you copied the entire Base64 string — these can be tens of thousands of characters long for a real file.
Is this private?
Yes. The decoding happens entirely client-side in JavaScript. The Base64 you paste is decoded into bytes in the browser and turned into a downloadable blob locally — it is never sent to a server. You can confirm this by opening DevTools → Network: pasting and decoding fires no request.
Frequently asked questions
How do I convert Base64 to a file?
Paste a full data URI or the raw Base64 payload into the box above. The tool decodes the bytes locally, sniffs the type from the leading bytes, and lets you download the result with the correct extension — or as a .bin file if the type can't be identified.
What file types are detected?
PNG, JPEG, GIF, WebP, SVG, and PDF are detected from their magic bytes. Anything else downloads as .bin — still the correct bytes, just a binary extension.
Why won't my Base64 decode?
Usually the string is truncated, or a copy/paste introduced stray characters. URL-safe Base64 without padding is handled automatically. If the input still isn't valid Base64, you'll see an error.
Is it private to decode Base64 files online?
Yes. Decoding runs entirely in your browser — nothing is uploaded, so even private or sensitive files stay on your machine.
Need to encode a file?
The main base64.dev tool handles text, files, and URL-safe mode with auto-detect.
Open base64.dev →