What Is a Base64 to File Converter?
A Base64 to file converter decodes a Base64-encoded string back into the original binary file, whether that's a PDF, image, ZIP archive, audio clip, Word document or anything else. Base64 is a way of representing binary data using only 64 safe text characters (A–Z, a–z, 0–9, + and /). It is used everywhere that files must travel through text-only channels: JSON API responses, email attachments (MIME), HTML and CSS data URIs, database text fields, configuration files and logs.
When you receive a long Base64 blob, for example a PDF invoice returned by an API or an image embedded in JSON, you need to decode it to see or save the actual file. This tool does that instantly. It even identifies the file type from its magic bytes, so you get the right extension without guessing. Decoding happens in your browser, and nothing is uploaded.
How to Convert Base64 to a File
- Paste the Base64 text into the box. A full data URI (
data:...;base64,...) or a bare Base64 string both work. - Check the options. Tick "URL-safe" if the string uses
-and_instead of+and/. Optionally type a file name. - Click "Decode & download". The type is detected, a preview is shown for images, PDFs, audio, video and text, and the file downloads.
Features
- Automatic file type detectionRecognises PDF, PNG, JPEG, GIF, WebP, SVG, ZIP, DOCX, XLSX, MP3, MP4, JSON and many more from the data itself.
- Data URI supportPaste complete
data:URLs. The MIME type they contain is used too. - Forgiving inputLine breaks, spaces and missing padding (
=) are handled automatically. - URL-safe Base64Decodes Base64URL used in JWTs, web tokens and URLs.
- Instant previewView images, PDFs, audio, video and text before saving.
- PrivateDecoding runs locally. Sensitive files never leave your device.
How Base64 Encoding Works
Base64 takes every 3 bytes (24 bits) of binary data and splits them into four 6-bit groups. Each group is a number from 0 to 63, represented by one character of the Base64 alphabet. If the data length isn't a multiple of three, the output is padded with one or two = characters. Because 3 bytes become 4 characters, Base64 text is about 33% larger than the original file. Decoding simply reverses this mapping to reconstruct the exact original bytes.
| Variant | Characters 62 and 63 | Used in |
|---|---|---|
| Standard Base64 | + and / | Email (MIME), data URIs, most APIs |
| Base64URL | - and _ | JWTs, URLs, file names |
Recognising Common Files by Their Base64 Prefix
| Base64 starts with | File type |
|---|---|
JVBERi0 | PDF document |
iVBORw0KGgo | PNG image |
/9j/ | JPEG image |
R0lGOD | GIF image |
UEsDB | ZIP, DOCX, XLSX or PPTX |
UklGR | WebP image or WAV audio |
Common Sources of Base64 Files
- API responses that return documents, invoices, labels or images as Base64 fields inside JSON.
- Email source code (.eml files), where attachments are Base64-encoded MIME parts.
- HTML and CSS with images and fonts embedded as data URIs.
- Databases and logs that store binary blobs as text.
- Shipping and payment integrations that deliver PDF labels or receipts as Base64 strings.
Copy the Base64 value, excluding surrounding quotes and the JSON key, paste it into the box above, and the original file is restored byte for byte.
Frequently Asked Questions
Can I decode Base64 on my phone?
Yes. Paste the string into the box in any mobile browser and the decoded file downloads to your device.
What if the file type can't be detected?
Unknown binary data is saved with a .bin extension. If you know the real type, type a file name with the right extension before decoding.
Can I decode a Base64 image?
Yes. Images are detected and previewed automatically. For image-specific options, you can also use our Base64 to Image tool.
How do I know what type of file my Base64 string is?
The tool inspects the decoded bytes for known file signatures ("magic numbers") and shows the detected type and MIME type automatically.
Why do I get an "invalid Base64" error?
The string may be truncated, contain characters outside the Base64 alphabet, or be URL-safe Base64. Tick the URL-safe option, and make sure you copied the complete string.
Is there a size limit?
There's no fixed limit. Strings of many megabytes decode in a moment, depending on your device's memory.
Is my data sent to a server?
No. Decoding happens entirely in your browser.
How do I convert a file to Base64?
Use our File to Base64 converter, which encodes any file as a Base64 string or data URI.