How to use
- Set the Direction menu to Encode — text to Base64 or Decode — Base64 to text. The pane labels and placeholders change to match.
- When encoding, tick URL-safe alphabet if the output goes into a URL or token, and Wrap at 76 characters if it feeds an email or other MIME consumer. Both options are ignored while decoding, which accepts either alphabet and skips whitespace.
- Type or paste into the input pane. Conversion runs as you type; the line under each pane reports character and byte counts so you can watch the size change.
- Grab the result with Copy, or use Download to save it as a
.txtfile. - Hit Swap ⇅ to push the output back into the input and flip direction — handy for confirming a value round-trips cleanly. Clear empties the input.
How it works
The scheme reads your input three bytes at a time — 24 bits — and re-slices those 24 bits into four groups of 6. Each 6-bit group (a value from 0 to 63) indexes one character in a fixed 64-entry table, so 3 bytes always become 4 printable characters. Text is first run through the browser’s TextEncoder, turning it into UTF-8 bytes before any of this begins.
Take the word Café. It is four characters but five bytes, because é is a single character that UTF-8 stores as two bytes: the full sequence is [67, 97, 102, 195, 169]. The first triple 67 97 102 becomes Q2Fm. That leaves two bytes over, 195 169, which fill three of the four output slots as w6k; a single = pads the empty fourth slot, marking that the final block carried two bytes rather than three. The complete encoding is Q2Fmw6k=. Decoding runs the mapping in reverse, then hands the recovered bytes to TextDecoder in strict mode — so anything that is not valid UTF-8 is reported as binary instead of printed as garbled characters.
Use cases & limitations
You reach for Base64 whenever raw bytes have to travel through a channel that only tolerates text: inlining a small icon as a data: URI, dropping a binary blob into a JSON field, matching the Content-Transfer-Encoding a mail library produced, or eyeballing the payload segment of a token before feeding the whole thing to the JWT decoder. If you are wrangling percent-encoding for query strings instead, that is a different transform handled by the URL encoder / decoder.
The honest limit: this page is built for text. It decodes only to UTF-8 and refuses byte sequences that are not valid text, because printing mojibake helps nobody. An image, PDF, font or compressed archive should go through the Base64 file converter, which decodes to a downloadable file. Also worth remembering — encoding inflates size by roughly a third, so Base64 is a transport wrapper, not a way to shrink or protect data.
Privacy note
Every conversion happens on your device. TextEncoder, the Base64 mapping and TextDecoder all run in the page, and no input is ever sent over the network — you can confirm that in your browser’s network tab. Because it is local, pasting a token or key to inspect its bytes is fine here. Just remember Base64 is reversible by anyone: use it to move data, never to hide it.