developername

Base64 encoder

Type or paste your text, choose encode or decode, and read the result. Non-Latin text, emoji and line breaks survive the round trip because the bytes are converted properly.

Runs locally in your browser

How it works

Base64 represents arbitrary bytes with 64 printable characters: A to Z, a to z, 0 to 9, + and /, with = padding the end. Every three bytes become four characters, so the output is always a multiple of four and about a third longer than the input. Encoding here converts the text to UTF-8 first and then to Base64, because the browser's own btoa only accepts bytes 0 to 255 and would reject most accented letters, all Arabic text and every emoji if it were handed the raw string. Decoding reverses the order: the Base64 is read back into bytes and those bytes are decoded as UTF-8, with a fatal decoder so a wrong input produces a message rather than a run of replacement characters.

Worked example

hello becomes aGVsbG8=: it is five bytes, and 5 ร— 4 รท 3 = 6.67 rounds up to the next multiple of four, which is eight characters. Stacklane is nine bytes, exactly three groups of three, so it becomes twelve characters: U3RhY2tsYW5l. The emoji ๐Ÿ˜€ is four bytes in UTF-8, which costs eight characters: 8J+YgA==. Decoding aGVsbG8= returns hello.

Questions and answers

Everything runs in your browser: your text, file or value is never uploaded anywhere.