Skip to content
Toolew.com

Base64 to File

Decode Base64 or a data URI back into a real file. Detects the file type from its signature, previews images, audio and video, and batch-exports ZIPs.

Runs in your browser. Your data is not uploaded.
Loading tool…

Tool guide

What this tool does

Base64 to File decodes Base64 text or data: URIs into downloadable files. It detects the type from the declared MIME type or the file’s magic bytes, recognising images, PDFs, archives, audio, video, fonts and text, shows a safe preview and the first bytes in hex, and can decode a whole list of strings into a ZIP.

APIs, databases, email sources and log files often carry files as Base64 text: an invoice PDF in a JSON response, a signature image in a database column, an attachment in raw email, or a screenshot in a bug report. To use the file you must decode the text back into bytes and save them with the right extension, and if the data comes without a MIME type you also need to work out what kind of file it is.

This tool decodes standard and URL-safe Base64, ignores whitespace and line breaks, and accepts complete data URIs, including percent-encoded ones such as SVG icons. When no type is declared, it reads the file signature, the first few bytes that identify formats like PNG (89 50 4E 47), PDF (%PDF), ZIP (PK), JPEG, GIF, WebP, MP3, MP4, WOFF2 and SQLite, and falls back to plain text detection. It warns when a declared type contradicts the signature. Previews use safe elements only: images display through an img tag, which never runs scripts, and HTML or PDF data is not rendered. Decoding happens on your device.

How to use Base64 to File

  1. Paste Base64 text or a data URI into the “Base64 or data URI” box, or click Sample.
  2. Check the Detected type, MIME type and File size.
  3. Set the “File name (without extension)” and, if needed, override the File type.
  4. Review the preview and the first bytes in hex.
  5. Click the Download button to save the file.
  6. For a list of strings, switch on “Each line is a separate file” and use “Download all (ZIP)”.

Tips for better results

  • Base64 strings starting with iVBOR are PNG, /9j/ is JPEG, JVBER is PDF and UEsDB is ZIP or an Office document.
  • DOCX, XLSX, PPTX, EPUB and APK files are ZIP containers, so they are detected as ZIP; choose the right extension in File type.
  • If decoding fails with a length error, the string was probably cut off when it was copied.
  • URL-safe Base64 with - and _ characters, as used in JWTs and many APIs, is accepted without conversion.

Common use cases

  • Saving a PDF or image returned as Base64 by a REST API.
  • Recovering an attachment from the raw source of an email.
  • Extracting images stored as Base64 in a database export or JSON file.
  • Checking what a mysterious Base64 blob in a log file actually contains.

Common mistakes to avoid

  • Copying the surrounding JSON quotes or a trailing comma along with the Base64 value, which makes decoding fail.
  • Saving decoded data with the wrong extension, so the operating system opens it in the wrong app.
  • Opening decoded HTML or SVG from an untrusted source directly in a browser tab, where embedded scripts can run.

Frequently asked questions

How does the tool know the file type?

It uses the MIME type in a data URI when there is one. Otherwise it compares the first bytes with known file signatures (magic numbers) for over 30 formats, and checks whether the data is valid UTF-8 text.

Is there a size limit?

The limit is your device’s memory. Strings of several hundred megabytes may be slow to paste, but files of tens of megabytes decode in a moment.

Why is there no PDF preview?

Rendering arbitrary documents from pasted data is a security risk, so only images, audio, video and plain text are previewed. Download the PDF to open it in your viewer.

Feedback & suggestions

Help us improve Base64 to File. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.