How Base64 works
Base64 encodes binary or text data using only 64 printable characters (A–Z, a–z, 0–9, + and /), so it can travel safely through systems that expect plain text — email, URLs, JSON, data URIs. It works by taking three bytes (24 bits) at a time and splitting them into four 6-bit groups:
Because 6 bits can hold 64 values, each group maps to one Base64 character. When the input isn't a multiple of three bytes, = padding fills the end. The result is about 33% larger than the original — the trade-off for being text-safe.
Worked example
Encoding the three letters "Cat" (ASCII 67, 97, 116):
Q2F0.Unicode and common uses
Plain btoa only handles Latin-1, so this tool first converts text to UTF-8 bytes before encoding, which means emoji and accented characters round-trip correctly. Base64 is everywhere: embedding small images as data: URIs, encoding binary attachments, Basic HTTP authentication, and storing tokens. It is encoding, not encryption — anyone can decode it, so never use it to hide secrets.