File ⇄ Base64
Convert any file to Base64 or a Data URI, and restore pasted Base64 back to a downloadable file — 20MB cap, fully local.
>_ USAGE GUIDE
Convert any file — not just images — into Base64 text or a Data URI for embedding into JSON, HTML, CSS or logs, and paste Base64 back to restore the original file as a download. Everything runs on your machine: encoding reads bytes with FileReader, decoding rebuilds a Blob in memory, and no network request is ever made.
- Encode: drop a file (up to 20MB) and the output shows the full Data URI with before/after sizes
- Copy what you need: "Copy Base64" for the bare string, "Copy Data URI" for a form that drops straight into
src/href - Decode: paste Base64 or a Data URI on the right (prefix and whitespace stripped automatically), name the file and download
- Watch the size: the info line shows the ~1.33× expansion so you can judge whether embedding is worth it
>_ FAQ
Q1 · How much bigger does Base64 make a file?
About 4/3 of the original (roughly 1.33×), plus the data: prefix and possible quote escaping in transport. Small icons and small fonts embed well; anything in the hundreds of kilobytes is better served as a separate file that can hit the browser cache.
Q2 · Data URI vs bare Base64 — which one?
Bare Base64 is just the encoded string; the receiver must know the content type separately. A Data URI is the self-describing data:<MIME>;base64,<encoding> form, usable directly in <img src>, <a href> or CSS url(). Browsers want Data URIs; API protocols usually want bare Base64.
Q3 · My pasted Base64 is "invalid" — what now?
Three usual causes: stray newlines or spaces (the tool strips those automatically), the URL-safe variant using -_ (normalized back automatically), and a length that leaves remainder 1 when divided by 4 — a truncated string. The error message names the cause; check the source accordingly.
Q4 · Why is there a 20MB cap?
Encoding holds both the raw bytes and the inflated string in browser memory (about 2.3× the file size); larger files can freeze mobile tabs. The cap protects the experience, not the algorithm — process big files locally with base64 file or openssl base64 -in file.
Q5 · Does the file content leave my device?
No. Encoding and decoding happen entirely in your browser with zero network requests. That is the premise for using it on sensitive documents — contracts, internal scans — since neither restoring nor generating ever touches a server.