# Base64 to File Converter

> Decode Base64, a data URI or hex back into a downloadable file, with the type detected automatically.

This decodes Base64, Base64url, a data URI or hexadecimal back into the original file. The type is taken from the data URI header when present, and otherwise identified from the decoded bytes' magic number — so a PNG, PDF or ZIP is recognised even from a bare Base64 string with no filename.

**URL:** https://convertto.tech/t/base64-to-file
**Category:** Encoders & Decoders (https://convertto.tech/c/encoding-tools)
**Privacy:** Runs entirely in the browser; no upload
**Cost:** Free, no sign-up
**Last updated:** 2026-08-01

## Key facts

- **Detects:** 24 file signatures including PNG, JPEG, PDF, ZIP, DOCX, XLSX, MP4, WOFF2 and SQLite
- **Accepts:** Data URIs, raw Base64, Base64url and hexadecimal
- **Privacy:** Runs entirely in your browser — nothing is uploaded
- **Cost:** Free, unlimited, no sign-up

## How to use

1. Enter or paste your base64, data uri or hex.
2. Choose the input is.
3. Enter or paste your file name.
4. Enter or paste your mime type override.
5. Press Run, then download the result when it is ready.

## FAQ

### How does it know what kind of file this is?

From the decoded bytes. Almost every binary format begins with a fixed signature — PNG starts with 89 50 4E 47, PDF with %PDF, ZIP with PK. The tool matches those, and refines ZIP further to spot DOCX, XLSX and EPUB by looking inside.

### Why does my Base64 fail to decode?

Usually a truncated paste or wrapped text that included a prefix. Base64 must contain only A-Z, a-z, 0-9, plus and slash, with optional trailing equals padding — anything else means part of the string is missing or extra.

## Related tools

- [File to Base64 Converter](https://convertto.tech/t/file-to-base64): Encode any file — image, PDF, video, font, archive — as Base64, a data URI, hex or a byte array.
- [PDF to Base64 Converter](https://convertto.tech/t/pdf-to-base64): Encode a PDF as a Base64 string or a data URI, ready to embed in code.
- [Base64 to PDF Converter](https://convertto.tech/t/base64-to-pdf): Decode a Base64 string into a real, downloadable PDF file.
- [Base64 Encoder & Decoder](https://convertto.tech/t/base64-encode-decode): Encode and decode Base64 with automatic direction detection, plus file and data-URI support.
- [Data URI Generator](https://convertto.tech/t/data-uri-generator): Turn text, SVG or CSS into a data: URI you can inline directly in HTML or stylesheets.
- [Multi-Format Encoder](https://convertto.tech/t/multi-encoder): Encode text into Base64, hex, binary, URL, HTML entities, ROT13 and more, all at once.
- [File Type Identifier](https://convertto.tech/t/file-type-identifier): Identify any file from its magic bytes, and see whether the extension is telling the truth.
- [Font to Base64 & CSS Generator](https://convertto.tech/t/font-to-base64): Convert font files directly into CSS @font-face data URIs.
- [GGUF Quantisation Size Calculator](https://convertto.tech/t/gguf-size-calculator): Work out the download size of a quantised model at every GGUF level, and what quality each one costs you.
