⇄ Base64 Encode / Decode
Convert text to Base64 and back. UTF-8 safe for accents, emoji and non-Latin scripts — and nothing leaves your browser.
How to use
- Type or paste text into
plain.txton the left and click Encode →. The Base64 string appears inencoded.b64on the right. - To decode Base64, paste it on the right and click ← Decode. The original text is restored on the left.
- Tick URL-safe before encoding to get output you can drop straight into a URL, cookie or filename.
- Swap exchanges the two boxes. Copy output copies whichever box was filled last.
What is Base64?
Base64 represents binary data using only 64 characters: A–Z, a–z, 0–9, + and /. It's how bytes travel through channels that only accept text — email attachments (MIME), data: URLs for images, HTTP Basic Auth headers, JSON fields that carry files, PEM certificates and JWTs.
The trick is simple: take 3 bytes (24 bits), split them into four 6-bit chunks, and map each chunk (0–63) to one character. That's why Base64 output is about 33% larger than the input. When the last group has fewer than 3 bytes, = padding is added so the length is a multiple of 4.
| Text | Bytes | Base64 |
|---|---|---|
Man | 3 | TWFu |
Ma | 2 | TWE= |
M | 1 | TQ== |
user:pass | 9 | dXNlcjpwYXNz (an HTTP Basic Auth header) |
café | 5 (é is 2 bytes) | Y2Fmw6k= |
Why accents and emoji don't break
The browser's native btoa() throws an error on anything outside Latin-1, which is why many quick snippets fail on "é" or "👋". This tool first converts your text to UTF-8 bytes and then Base64-encodes those bytes — the same thing Python's base64.b64encode(s.encode()) or Node's Buffer.from(s).toString('base64') does. Decoding is strict UTF-8 too: if the decoded bytes aren't valid UTF-8 text, you'll see an error instead of garbled characters.
Standard vs. URL-safe Base64
| Variant | 62nd char | 63rd char | Padding |
|---|---|---|---|
| Standard Base64 (RFC 4648 §4) | + | / | = added |
| URL-safe / Base64URL (RFC 4648 §5) | - | _ | usually omitted |
Decoding accepts both variants whether or not the checkbox is ticked: - and _ are converted back, missing = padding is restored, and spaces or line breaks in the middle are ignored — handy for line-wrapped MIME or PEM data.
Base64 is not encryption. Anyone can decode it instantly, so never use it to "hide" passwords or personal data. This tool is text-only: decoding an image or PDF will show a UTF-8 error. Everything runs in your browser and nothing is uploaded.