# File to Base64

> Encode any file as Base64 or a data URL, and decode it back. Runs entirely in your browser — nothing is uploaded.

Source: https://toffeekit.com/tools/file-to-base64

**Category:** [Files](https://toffeekit.com/category/files) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/file-to-base64

**Also useful for:** base64, file to base64, base64 to file, data url, decode base64, encode file

## What you can do

- **Embed a file** — Turn a font, PDF or icon into a data URL. ([open with this preset](https://toffeekit.com/tools/file-to-base64?preset=encode))
- **Recover a file** — Paste Base64 from an API or email and save the file. ([open with this preset](https://toffeekit.com/tools/file-to-base64?preset=decode))

## How it works

1. On File to Base64, drop any file up to 100 MB or click Choose file.
2. Pick Base64 or Data URL, and set Line breaks or URL-safe if your target needs them.
3. Copy the result or save it as a .txt file.
4. On Base64 to file, paste Base64 or a data URL, check the detected type and File name, then download.

## FAQ

### How do I convert a file to Base64?

Drop it on the File to Base64 tab. The encoded text appears straight away, ready to copy or save as .txt.

### What is a data URL?

Base64 with a prefix such as data:application/pdf;base64, so browsers can use it directly in src, href or CSS url() values.

### Why is Base64 bigger than the original file?

Base64 turns every 3 bytes into 4 text characters, so the output is about 33% larger, plus line breaks if you add them.

### What are the 76 and 64 line break options for?

Email (MIME) wraps Base64 at 76 characters and PEM certificates and keys at 64. Most other uses want no line breaks.

### What is URL-safe Base64?

Base64URL swaps + and / for - and _ and drops the = padding, so the text is safe in URLs and JSON Web Tokens.

### Is File to Base64 free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so your files are processed on your device and never uploaded. It works on phones and computers alike.

## Privacy

File to Base64 runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [ZIP Creator](https://toffeekit.com/tools/zip-creator) — Bundle files and folders into a ZIP archive.
- [ZIP Extractor](https://toffeekit.com/tools/zip-extractor) — Open a ZIP, preview and extract its files.
- [File Checksum](https://toffeekit.com/tools/file-checksum) — MD5 and SHA hashes of files, with verify.
- [File Type Detector](https://toffeekit.com/tools/file-type-detector) — Find a file's real type from its magic bytes.
- [Hex Viewer](https://toffeekit.com/tools/hex-viewer) — Inspect any file byte by byte in hex.
- [File Splitter & Joiner](https://toffeekit.com/tools/file-splitter) — Split big files into parts and join them back.

