Paste any Base64 string or data URI to turn it back into a real file. The tool reads the file signature (magic bytes) to name it correctly, previews images, PDFs, audio, video, text and ZIP contents, and lets you download it in one click, all in your browser.
Last updated:
Samples:
0 characters
Decoded file
Paste Base64 on the left to see the decoded file here
File type
-
MIME type
-
File size
-
SHA-256
-
Decoding happens in your browser: the Base64 text and the decoded file are never uploaded. Opening a decoded file runs nothing; executables are only saved, not started.
Advertisement
Advertisement
How to use the Base64 to File
Paste the Base64 (with or without a data:…;base64, prefix) into the left box, open a .txt file that contains it, or try a sample.
Let it decode: the result appears instantly; press Decode Base64 if you turned off typing.
Check the detected type, size and SHA-256, and look at the preview or the Hex tab.
Adjust the file name if you like; the extension follows the detected type.
Download the file or open it in a new tab.
Common file signatures (magic bytes)
These are the first bytes the decoder looks for. The Base64 column shows how each signature begins once encoded, which lets you guess a file type just by looking at the start of a Base64 string:
File type
First bytes (hex)
Base64 starts with
MIME type
PDF
25 50 44 46 (%PDF)
JVBERi
application/pdf
PNG
89 50 4E 47 0D 0A 1A 0A
iVBORw0KGgo
image/png
JPEG
FF D8 FF
/9j/
image/jpeg
GIF
47 49 46 38 (GIF8)
R0lGOD
image/gif
WebP / WAV / AVI
52 49 46 46 (RIFF)
UklGR
image/webp, audio/wav, video/x-msvideo
ZIP, DOCX, XLSX, PPTX, EPUB, JAR
50 4B 03 04 (PK)
UEsDB
application/zip and Office types
MP3 with ID3 tag
49 44 33 (ID3)
SUQz
audio/mpeg
MP4 / MOV / M4A
?? ?? ?? ?? 66 74 79 70 (ftyp at offset 4)
AAAAIGZ0eXA, AAAAGGZ0eXA…
video/mp4, video/quicktime, audio/mp4
GZIP
1F 8B
H4sI
application/gzip
Windows EXE / DLL
4D 5A (MZ)
TVq
application/vnd.microsoft.portable-executable
WOFF2 font
77 4F 46 32 (wOF2)
d09GMg
font/woff2
JSON text
7B ({)
ey
application/json
Where Base64 files usually come from
API responses: many APIs return documents, signatures, labels and receipts as a Base64 field inside JSON. Paste the whole JSON object: the tool picks the longest Base64 value automatically.
Email (MIME): attachments are Base64 with line breaks every 76 characters. Copy the block between the part headers; the line breaks are ignored.
Data URIs in HTML, CSS or browser dev tools: data:font/woff2;base64,… and similar. The declared type is checked against the real bytes.
JWTs and URLs use URL-safe Base64 (- and _ instead of + and /, often without padding), which is converted automatically.
Most file formats start with a fixed signature, called magic bytes: PDF files begin with %PDF, PNG with the bytes 89 50 4E 47, ZIP with PK. The decoder compares the first bytes with a table of known signatures and, for ZIP-based formats, looks at the file names inside to tell DOCX, XLSX, PPTX, EPUB, JAR and APK apart.
What if the data URI says a different MIME type?
The declared type in data:<mime>;base64 is only a label and is sometimes wrong (for example application/octet-stream). The tool trusts the bytes, shows a warning when they disagree and uses the detected type for the extension. If no signature matches, the declared type is used.
Why do I get 'invalid character' or 'truncated' errors?
Base64 only contains A–Z, a–z, 0–9, + and / (or - and _ in the URL-safe variant) plus = padding. Other characters usually mean the text was URL-encoded, HTML-escaped or cut off. A length that leaves one leftover character after grouping by four is impossible, which means part of the string is missing.
How big is the decoded file compared with the Base64 text?
Base64 encodes every 3 bytes as 4 characters, so the file is about 75% of the Base64 length (characters × 3 ÷ 4, minus one byte per = padding sign). For example, 1,000,000 Base64 characters decode to roughly 750 KB.
Can I decode very large Base64 strings?
Yes, up to tens of megabytes, limited only by your browser's memory. Pasting extremely long text can make the text box slow; opening the Base64 from a .txt file is faster.
Is it safe to decode Base64 from an unknown source?
Decoding and previewing are safe: HTML and SVG are shown as text or a static image, and nothing is executed. The decoded file itself can still be harmful, so do not run executables or open macro-enabled documents you do not trust.
Is my data uploaded?
No. Decoding uses the browser's built-in atob function and runs entirely on your device. The Base64 text and the decoded file never leave your computer.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.