Base64 encoder / decoder
Encode text to Base64 or decode Base64 back to text. UTF-8 safe, with the URL-safe alphabet as an option.
How it works
Text is first turned into UTF-8 bytes, so accented letters and emoji survive. Every 3 bytes (24 bits) become 4 characters of 6 bits each; = pads the end when the length is not a multiple of 3.
Worked example
“Man” in Base64:
- M a n → 77 97 110
- 01001101 01100001 01101110 → 010011 010110 000101 101110
- 19 22 5 46 → TWFu
Frequently asked questions
What is Base64?
A way to write any bytes with 64 safe characters (A–Z, a–z, 0–9, + and /), used to put binary data or special characters into email, JSON, URLs and data: links. It is an encoding, not encryption: anyone can decode it.
What is URL-safe Base64?
A variant that uses - and _ instead of + and / and usually drops the = padding, so the result can go into a URL or a file name. JWTs use it.
Why does my decoded text look broken?
The Base64 probably holds binary data (an image, a zip file) rather than text, or text in an encoding other than UTF-8.