Base64 to File

Paste a Base64 string or data URI and turn it back into a real, downloadable file — free and instant. Decoding happens in your browser; nothing is uploaded.

Whitespace and line breaks are ignored. URL-safe Base64 (with - and _) and missing = padding are handled automatically.

How to convert Base64 to a file

  1. Paste your Base64. Drop the encoded string into the box — a raw Base64 string and a full data:…;base64,… URI both work, line breaks and all.
  2. Decode it. Press Decode. The tool validates the string, detects the file type from its content, and shows the decoded size plus a preview for images and text.
  3. Name it and download. Adjust the suggested file name or MIME type if you like, then hit Download file to save the reconstructed file.

About this tool

This Base64 to file converter is the reverse of a Base64 encoder: it takes text-encoded binary data — from an API response, an email attachment, a JSON payload, a database column or an inline data URI — and rebuilds the original file so you can save and open it. The decoder recognises common formats automatically (PNG, JPG, GIF, WebP, PDF, ZIP, MP3, MP4 and more) by inspecting the decoded bytes, and suggests a matching file extension. Images are previewed right on the page, and decoded text is shown so you can confirm you got the right data before saving.

Everything runs locally in your browser using JavaScript — the Base64 string is never sent to a server, so it is safe to decode private documents, credentials or any confidential payload. If the string is not valid Base64, you get a clear error message instead of a corrupted file.

Frequently asked questions

Why do I get an "invalid Base64" error?

The string contains characters outside the Base64 alphabet (A–Z, a–z, 0–9, + and /, or - and _ in the URL-safe variant), or it has an impossible length. Common causes: the string was cut off mid-copy, HTML entities like + crept in, or you pasted extra surrounding text such as quotes or JSON keys.

How does the tool know what type of file it is?

Most file formats start with a characteristic "magic number" — PNG files begin with the bytes 89 50 4E 47, PDFs with %PDF, ZIPs with PK. The tool checks these signatures after decoding, and also honours the MIME type of a pasted data URI. You can always override the detected type and extension before downloading.

The downloaded file won't open — what went wrong?

Usually the Base64 string was incomplete or was double-encoded. Compare the decoded size shown here to the expected file size: if it is much smaller, part of the string is missing. If the preview shows another Base64 string as text, the data was encoded twice — copy the previewed string and decode it again.

Is my data uploaded during decoding?

No. The whole conversion runs in your browser's memory and the page makes no network requests with your data. You can even disconnect from the internet after loading the page and it still works.