Base64 File Converter
Drop any file and stream it to Base64 with live progress — or turn Base64 back into a named, downloadable file, entirely on this device.
Drop a file here or choose one — it is read on this device, never uploaded.
Press ? for shortcuts
Do it offline:$ base64 -w 0 file.bin
How to use it
- Drop a file onto the input pane or pick one — the drop itself starts the run. From 256 KB the work moves to a worker with a progress bar and Cancel.
- Pick an output form: raw is one unbroken line, wrap 64 and wrap 76 insert line breaks, and data: URI adds a prefix carrying the sniffed MIME type.
- Copy the result, or download it as <name>.base64.txt; the byte and character counts are read from the real buffers.
- For the way back, open Decode and paste Base64 or a whole data: URI: you get a file card, a text preview when the bytes are clean UTF-8, and a decoded.<ext> download.
Drop any file — binary or text, up to 16 MB — and it is encoded to Base64 in chunks with live progress. Choose the shape the destination needs: one raw line, lines wrapped at 64 or 76 columns, or a data: URI. The Decode tab turns pasted Base64 back into a named, downloadable file. The bytes stay on this device in both directions.
Examples
pixel.png — a 67-byte 1×1 PNGiVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR42mNgAAAAAgAB5Sfe/AAAAABJRU5ErkJggg==The drop is the run — no Convert button. 67 bytes become 4 × ⌈67 ÷ 3⌉ = 92 characters on one line, == marking a final group of one byte; Download saves pixel.png.base64.txt.
the same pixel.png as a data: URIdata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR42mNgAAAAAgAB5Sfe/AAAAABJRU5ErkJggg==Identical 67 bytes, one prefix more: the MIME comes from the file's own PNG signature, and the whole URI is 114 characters.
-__-AQdecoded.bin — 4 bytes, application/octet-stream
URL-safe alphabet detected (- and _ accepted)
Missing padding was acceptedSix URL-safe characters, padding missing. Each repair is a declared chip; the four bytes are neither clean UTF-8 nor a known signature, so the download is honestly named decoded.bin.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Chunked encoding is exact, not approximate
Big files are walked 98,304 bytes at a time — 0x8000 × 3, deliberately a multiple of 3, so each chunk fills whole four-character groups and no padding lands at a seam. The joined chunks are byte-identical to a one-pass encoding — progress never changes the output.
Output size is arithmetic, never an estimate
A file of n bytes encodes to 4 × ⌈n ÷ 3⌉ characters: 67 bytes make 92, and 3,000,000 make exactly 4,000,000. Wrapping only adds breaks — at 76 columns the 92-character sample becomes 93. The status line counts the real output; the formula always agrees.
An empty file is not an error
A zero-byte file yields a zero-character output plus a note saying exactly that: “The file is empty — 0 bytes in, 0 Base64 characters out.” Placeholder assets round-trip cleanly instead of tripping a refusal.
Unknown bytes are named .bin, not guessed
The Decode file card comes from magic-byte sniffing — common image, archive, document, audio, video and font signatures, plus a clean-UTF-8 check that names text .txt. Anything else is application/octet-stream, downloaded as decoded.bin. A data: URI's declared type is shown beside the sniffed one.
The data: URI form warns at 2,000 characters
A data: URI is one long token; an HTML attribute or config field must swallow it whole. RFC 2397 sets no maximum, so this page draws its own line: from 2,000 characters the output carries a warning chip, never a hard stop. The prefix MIME is always the sniffed one.
Common errors
Invalid Base64: character '"' at position 1- The paste kept the JSON quotes. The first bad character is reported at its 1-based position, input untouched — drop the quotes and the value decodes.
Base64 length is invalid — 1 stray character- No encoder emits a 4n + 1 length: one character was lost or gained, usually a tail cut mid-copy. Recover the full string — trimming the stray decodes to the wrong bytes.
Input is larger than the 16 MB limit for this tool. For bigger files use the CLI: base64 -w 0 file.bin- A refusal, never a truncation. The printed command is GNU coreutils, where -w 0 keeps one line; the BSD base64 on macOS lacks -w but prints one line anyway: base64 -i file.bin.
One file at a time — drop a single file to encode it.- A multi-file drop is refused whole rather than silently encoding just the first file. Convert one at a time; batches and archives are out of scope here.
FAQ
When should I use this page instead of the Base64 text encoder?
Bring files here, typed or pasted text there. This page reads a whole file as bytes — any format, progress on large inputs, four output shapes — and Decode rebuilds a downloadable file. Character encodings never enter it: a file's bytes already are what they are.
Why is the Base64 version about a third bigger than my file?
Base64 spends 4 characters per 3 bytes, since each character carries only 6 of a byte's 8 bits. On whole groups the growth is exactly 4 ÷ 3 — 3,000,000 bytes become 4,000,000 characters — and small files round up to a multiple of 4 with = padding.
Does my file get uploaded when I convert it?
No. The file is read and encoded in your browser — in a worker thread for big inputs — and the Share control promises the same: “Share links carry settings and pasted text — file bytes never leave this device.” The network panel confirms it during a run.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Run or re-run the current conversion.
- ⌘/Ctrl + S
- Download: <name>.base64.txt on Encode, decoded.<ext> on Decode.
- ⌘/Ctrl + C
- Copy the output when nothing is selected.
- ⌘/Ctrl + Shift + C
- Copy the output even while a selection is active.
- s
- Swap — Encode hands its output to Decode (undoable); Decode just switches tabs.
- t
- Switch the theme from the keyboard (ignored while typing).
- ? or ⌘/Ctrl + /
- Open the shortcut help overlay.
- Esc
- Close the topmost dialog.