Convert between text and Base64 both ways, with full UTF-8 support, a URL-safe variant, and file-to-Base64. Runs fully in your browser.
Base64 takes binary data three bytes at a time (24 bits) and re-splits it into four 6-bit groups. Each group maps to one of 64 printable characters: A–Z, a–z, 0–9, plus + and /. The result is text that survives any channel that only accepts plain ASCII.
Because three bytes become four characters, encoded output is about 33% larger than the input. If the input length is not a multiple of three, the encoder pads the last group with = — one pad for a two-byte remainder, two pads for a one-byte remainder.
Base64 is not encryption and provides no secrecy whatsoever. Anyone can decode it in one step. It is a transport encoding: its job is to make binary safe to carry, not to hide it. If you need confidentiality, encode and then encrypt — never encrypt "with" Base64.
| Context | Why Base64 is used there |
|---|---|
| Email attachments (MIME) | SMTP was designed for 7-bit text and cannot carry raw binary |
| Data URIs in CSS and HTML | Lets a small image be embedded directly in a stylesheet |
| JSON and XML payloads | Carries a binary field inside a text document |
| JWT (JSON Web Tokens) | URL-safe Base64 of the header, payload and signature |
| HTTP Basic authentication | Username and password joined by a colon, then encoded |
The standard alphabet uses + and /, both of which have meaning inside a URL. The URL-safe variant (RFC 4648 §5) swaps them for - and _ and often drops the = padding. A string decoded with the wrong alphabet will either fail or silently produce garbage, so check which flavour a system expects — JWT always uses the URL-safe one.
The word Man encodes to TWFu, and Ma encodes to TWE= with a single pad. If you can reproduce those two by hand, the algorithm has clicked.