Skip to main content
Preparing workspace

Base64 to File

Decode a Base64 string or data: URL, identify the file from its magic number across 30+ signatures, and save it with the correct extension.

Still loading. If the tool doesn’t appear, reload this page.

About this tool

Base64 to File

Turn Base64 strings or data URLs into downloadable files.

Base64 to File decodes a Base64 string or a data: URL back into the original bytes, identifies what the file actually is by reading its magic number, and saves it with the correct extension. It checks more than 30 signatures — PNG's 89 50 4E 47, JPEG's FF D8 FF, PDF's %PDF-, the ZIP local-file header PK\x03\x04 and others — so a payload with a wrong or missing MIME type is still saved correctly. It is for developers pulling attachments out of API responses, logs and database rows.

How to use Base64 to File

  1. Paste the payload into the Base64 payload or data URL box; the bytes are decoded in this tab and the type is read from the magic number, so there is no format to pick.

  2. Check the Decoded payload panel — Detected type, MIME type, Decoded size, Base64 length, First 8 bytes, Byte-order mark, Entropy, Declared media type and Suggested file name, plus a Text preview of the first 240 characters when the payload is text.

  3. Set a name in File name (extension is added for you), then click Save file to download it, Copy as data URL to copy the payload with its detected MIME type, or Reset to go back to the sample.

Why use Base64 to File

  • Type from the bytes

    The extension comes from the file signature, not from the sender's Content-Type header.

  • Mismatch warnings

    If the data: URL claims application/pdf but the bytes are a PNG, the tool says so.

  • Entropy check

    A reading at or above 7.5 bits/byte tells you the payload is already compressed or encrypted.

Common use cases

  • Recover an email attachment that survives only as a Base64 column in a database export
  • Check whether an upload stored as Base64 is really a PDF, or an HTML error page that was encoded by mistake
  • Turn a data: URL copied out of a browser devtools panel back into a file you can open locally

Frequently asked questions

How do I convert Base64 back to a file?

Paste the Base64 (with or without the `data:…;base64,` prefix) and press Save file. Every 4 Base64 characters become 3 bytes per RFC 4648, and the extension is chosen from the decoded file's magic number — so a PNG is saved as .png even if nothing in the string said so.

Link to answer
What file types can this identify?

Over 30, including PNG, JPEG, GIF, WebP, BMP, TIFF, ICO, PDF, ZIP (and the .docx/.xlsx/.pptx/.odt/.epub files built on it), GZIP, BZIP2, 7z, RAR, TAR, MP3, WAV, FLAC, OGG, MP4, WebM, MIDI, WOFF/WOFF2/TTF/OTF fonts, SQLite databases, ELF and Windows executables. Anything unmatched but valid UTF-8 is treated as text; the rest is saved as .bin.

Link to answer
Why is my Base64 string longer than the file?

Base64 encodes 3 bytes as 4 characters, a fixed 33.3% increase, plus up to 2 padding characters and any line breaks. A 1 MB file becomes about 1.37 MB of Base64, which is why it is a transport format rather than a storage format.

Link to answer
Is my data uploaded anywhere?

No. Decoding, type detection and the download all run in your browser tab using client-side JavaScript; the payload is never sent to a server, which matters when the file is a signed document or a private key export.

Link to answer

Embed this tool on your site

Add the Base64 to File widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.

<iframe src="https://www.altftool.com/embed/widget/base64-to-file"
  title="Base64 to File — free AltFTool widget"
  width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
  loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/base64-to-file?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>

Browse all embeddable widgets →