Base64 encoder/decoder
Encode text to Base64 or decode Base64 back to text, with correct handling of unicode characters.
How it works
Base64 takes 3 bytes at a time — 24 bits — and re-slices them into
four 6-bit chunks. Six bits has exactly 64 possible values, and each maps to one
character from a fixed set of A–Z, a–z, 0–9, +
and /. That regrouping is why encoded output runs
about a third longer than the input, and why text that doesn’t divide into
3-byte groups ends in one or two = padding
characters. Encoding here goes through UTF-8 first, so accented letters, emoji,
and non-Latin scripts survive the round trip intact.
Used this in a paper or lesson?