File Base64
Drop a file here, or click to choose one
Extract pure Base64 (data: prefix removed)
How to Use
📖 Tool Introduction
File Base64 is a two-way converter built for two everyday jobs: turning any file into a Base64 string that you can paste straight into HTML, email, JSON or a config file, and turning a Base64 string you already have back into the original file for download. On the encode side the browser's native FileReader.readAsDataAPI reads the file, then the data:mime;base64, prefix is stripped automatically so the output is a clean pure-Base64 string, while the source size and string length are shown side by side for quick cost estimation. On the decode side the input may or may not carry a data: prefix; the tool reads the declared MIME type from it, runs a strict character-set and length check, converts the string back to bytes with atob, and then proposes an extension derived from the type (png, jpg, pdf, txt, zip and more, falling back to .bin when unknown) before downloading. Because Base64 takes about 1.37 times the original size, files are capped at 30 MB so an overlong string never freezes the tab. Everything runs locally in your browser, so even classified files can be encoded safely. The interface keeps the two directions on one card: a pill-style switch at the top, a dashed drop zone on the encode side, a monospace textarea on the decode side, and a compact toolbar for copy and download.
✨ Key Features
- Two-way conversion: file to Base64 and Base64 back to file, one click to switch
- Pure output: the data: prefix is stripped so the string is ready to paste
- Smart restore: MIME from a data: prefix is detected and the extension is chosen
- Strict validation: bad characters or misaligned length produce a clear error
- Live stats: source size and Base64 character count shown together
- Local loop: FileReader and Blob never touch the network, zero uploads
📝 How to Use
- Start in file-to-Base64 mode and drop or pick the file to encode
- The output area shows the pure Base64; copy it or save it as .b64.txt
- Switch to Base64-to-file mode and paste the string into the input box
- Check the detected type, restored size and suggested name, then restore
- Click download to save the restored file locally
⚠️ Notes
- Size limit: encoded files stay under 30 MB, or long strings slow the browser
- Length check: Base64 length must be a multiple of four, or you are asked to check
- Type detection: strings without a declared MIME restore as octet-stream .bin
- Alphabet: only standard Base64 is accepted; URL-safe -_ must be converted first
- Privacy: the whole round trip is local, with nothing sent to a server
🧰 Common use cases
Base64 is the bridge between binary files and text channels: it turns images, PDFs and fonts into printable text that survives JSON, HTML, mail bodies and plain database fields, and it turns that text back into the original bytes. Web developers embed tiny images as data URLs in stylesheets to avoid extra requests; API consumers decode attachment payloads that arrived inside JSON; designers paste a base64 string from a tutorial and need the real image back. The encode side reads your file with the browser reader, strips the data URL prefix and leaves only the pure base64 payload, while the decode side first validates the alphabet and length so a mistyped string is rejected politely instead of producing garbage. MIME information kept in the data URL is used to guess the right extension when you save the decoded blob. Because the whole loop runs in the page, sensitive documents are never uploaded to a server, and you can keep working even when the network drops.