How to use Base64 to File
- Paste Base64 or a data URI. Whitespace and line breaks are ignored.
- The status shows the detected type and size, and the pane shows a preview: the start of the text, or a hex dump of the first 512 bytes for binary files.
- Optionally set a File name; the right extension is added when you leave it off.
- Click Download to save the file.
Example
The sample is a data URI holding a short JSON document. It decodes to JSON document · 62 B, the preview shows
{"tool":"Base64 to File","detects":["PDF","ZIP","DOCX","PNG"]}
and the download is named file.json.
Detected formats
- Documents: PDF, DOCX, XLSX, PPTX, ODT, ODS, EPUB, RTF, legacy DOC/XLS/PPT.
- Images: PNG, JPEG, GIF, WebP, AVIF, HEIC, BMP, ICO, TIFF, SVG.
- Audio and video: MP3, WAV, Ogg, FLAC, M4A, MP4, MOV, WebM, AVI.
- Archives: ZIP, GZIP, BZIP2, XZ, 7-Zip, RAR, TAR, JAR, APK.
- Fonts: WOFF, WOFF2, TTF, OTF.
- Other: SQLite databases, WebAssembly, ELF, PE and Mach-O executables, JSON, XML, HTML and plain text.
Anything else downloads as file.bin with type application/octet-stream.
Where Base64 files come from
APIs often return generated documents as Base64 fields: a PDF invoice, a signed contract, a shipping label or an export. Email sources carry attachments as Base64 between MIME boundaries, logs and databases sometimes store uploaded files as text, and front-end code embeds fonts and icons as data URIs. In all of these cases the label next to the data may be missing or wrong, so the tool checks the bytes before naming the file.
If the decoded bytes match no known format, they may be compressed, encrypted or simply truncated. Check that the whole string was copied, and look at the hex dump: readable fragments suggest text in another encoding, while uniformly random bytes usually mean encrypted data.
Related tools
Encode a file with File to Base64. For Base64 that is just text, Base64 Encode / Decode shows the decoded string directly. For images with a visual preview, use Base64 to Image.
Frequently asked questions
How does it know what kind of file it is?
From the decoded bytes' signature, not from the data URI's label: %PDF is a PDF, PK followed by word/ is a DOCX (xl/ is XLSX, ppt/ is PPTX), ID3 is an MP3, SQLite format 3 is a database, MZ a Windows executable, and so on for about 40 formats. Text without a signature is checked for JSON, SVG, HTML and XML.
What if the data URI's type is wrong?
The bytes win and a warning names both types, so a PNG labelled application/pdf downloads as a .png. The declared type is only used for plain text, where it is more specific (text/csv rather than Text), or when the bytes match no known format.
Which inputs are accepted?
Plain Base64, Base64URL (with - and _), Base64 with line breaks or spaces, and data URIs, including percent-encoded ones without ;base64 such as data:text/plain,Hello%20world. Padding is optional.
Is it safe to decode an unknown file?
Decoding only turns text into bytes; nothing is opened or run. The preview shows text or a hex dump, never rendered HTML. HTML and SVG get a warning because they can contain scripts if you later open them in a browser, and executables are labelled as such.
Is my data uploaded?
No. Decoding happens in your browser; neither the Base64 nor the file is sent anywhere.
Last updated