Base64 to File Converter – Free

Decode Base64 to a file when you do not know, or do not care, what type it is. The tool rebuilds the original bytes locally, identifies common formats by signature and offers a download.

How to use the Base64 to File tool

  1. Paste your data into the Base64 or Base64 data URL box, or select Example to try a short sample.
  2. Select Decode file to turn the text back into bytes.
  3. Read the Result line, which gives the exact byte count and the detected media type.
  4. If the data is an image, audio or video the tool recognizes, review it in the preview under the result.
  5. Select Download to save the file. Rename it if the detected extension is .bin.

How Base64 to File detects the type

Base64 carries bytes and nothing else: no file name, no extension, no media type. To give the download a sensible name, this tool reads the first bytes of the decoded data and compares them with known signatures, often called magic numbers. The type written in a data URL prefix is not used for this decision.

  • PNG, JPEG, GIF and WebP images, saved as .png, .jpg, .gif or .webp.
  • MP3, WAV and Ogg audio, saved as .mp3, .wav or .ogg.
  • MP4 and WebM video, saved as .mp4 or .webm.
  • PDF documents that begin with %PDF-, saved as .pdf.
  • ZIP archives, saved as .zip. Word, Excel and other ZIP based documents land here too.
  • Everything else, saved as decoded.bin with the type application/octet-stream.

Worked example: text has no signature

The Example value is the Base64 of a 13 character greeting. Plain text has no magic number, so the tool cannot tell it from any other unknown data. It reports the generic type and uses the .bin extension. Rename the download to .txt and it opens as text. The same applies to JSON, CSV and XML.

Input:   SGVsbG8sIHdvcmxkIQ==
Result:  13 bytes · application/octet-stream
File:    decoded.bin  (contents: Hello, world!)

Accepted Base64 variants and strict checks

Standard Base64 and Base64URL (RFC 4648 sections 4 and 5) both decode. Padding is optional, and spaces, tabs and line breaks are stripped first, so MIME text wrapped at 76 columns can be pasted as is. A data URL may include extra parameters such as charset before the base64 marker.

The decoder refuses input that a lenient decoder would silently repair. Padding must make the length a multiple of four. A single leftover character is an error. So are leftover bits that are not zero, as in SGVsbG9= where the final character holds bits that belong to no byte. All of these produce the message Enter valid Base64 or Base64URL data.

When to use a format-specific decoder instead

This page never rejects data for being the wrong kind of file, which suits exploring an unknown blob. Base64 to PDF, Base64 to PNG, Base64 to ZIP and the other typed decoders fail loudly if the signature does not match. Base64 to Word and Base64 to Excel also open the ZIP container to confirm the document parts and save with the .docx or .xlsx extension, which this tool does not do.

Frequently asked questions

Does Base64 to File send my data to a server?

No. Decoding and type detection run in your browser. The Download link points at a temporary in-memory object that is released when you clear the form or close the tab.

Why is my file saved as decoded.bin?

None of the eleven built-in signatures matched the first bytes. That is normal for text formats and for binary types such as TIFF, 7z or SQLite. The content is intact; give it the correct extension yourself.

How do I find out what an unknown Base64 string contains?

Decode it here and read the media type in the Result line. If it says application/octet-stream, run the string through Base64 to Hex and look up the first bytes, or try Base64 to Text.

Is there a maximum size for the decoded file?

The decoder has no fixed limit. Very large strings are bounded by browser memory, since the pasted text and the decoded bytes are both held at once. Encoding is different: File to Base64 stops at 20 MiB.

Why does a Word document download as a ZIP?

A .docx file is a ZIP archive, and its first bytes are the ZIP signature. This general tool stops there. Rename the download to .docx, or use Base64 to Word, which checks the contents and sets the extension.

Related tools