Base64 encoder and decoder
Base64 writes any data with 64 safe characters: "Man" becomes "TWFu". Every 3 bytes become 4 characters, so the result is about a third longer.
- Checked on thousands of cases
- Sources: RFC 4648
- Updated November 6, 2026
Quick challenge
Streak 0Best 0
Test yourself: every answer is computed by the tool, and the wrong choices are the most common traps.
How it works
Formula: Characters = 4 × ⌈bytes ÷ 3⌉
The text is first turned into bytes with UTF-8: one byte for a basic Latin letter, two to four for accented letters and emoji. The bytes are read 3 at a time, 24 bits cut into 4 groups of 6 bits; each group, from 0 to 63, picks a character among A–Z, a–z, 0–9, + and / (RFC 4648). When the last group has only 1 or 2 bytes, "=" pads the result to a multiple of 4. The URL-safe variant uses - and _ instead of + and /.
Worked examples
"Man"
3 bytes → 4 characters: TWFu.
"Ma"
2 bytes: one = fills the group, TWE=.
"é"
2 bytes in UTF-8: w6k=.
Common mistakes
Using Base64 to protect a password.
Anyone can decode it without a key: it is not encryption.
Thinking the size stays the same.
30 bytes give 40 characters: a third more.
Putting standard Base64 in a URL: "??>" gives Pz8+, and the + turns into a space there.
Use the URL-safe variant: Pz8-.
RFC 4648 test vectors
| Text | Base64 |
|---|---|
| "" | "" |
| "f" | "Zg==" |
| "fo" | "Zm8=" |
| "foo" | "Zm9v" |
| "foob" | "Zm9vYg==" |
| "fooba" | "Zm9vYmE=" |
| "foobar" | "Zm9vYmFy" |
Size once encoded
| Bytes | Characters |
|---|---|
| 1 | 4 |
| 2 | 4 |
| 3 | 4 |
| 10 | 16 |
| 100 | 136 |
| 1,000 | 1,336 |
| 1,000,000 | 1,333,336 |
Frequently asked questions
Is Base64 a form of encryption?
No. Anyone can decode it, without a key: it only lets data travel safely as text (emails, JSON, URLs). Never use it to hide a password.
Why does my Base64 end with = or ==?
The length was not a multiple of 3 bytes: one = means the last group had 2 bytes, == means it had only 1.
Why is the encoded text longer?
Every 3 bytes become 4 characters, a third more, plus the padding. Accented letters and emoji take 2 to 4 bytes in UTF-8, so they grow even more.