Base64 encoder
Processed in your browser · nothing is uploaded
Encodes text as Base64 through UTF-8, so accented characters and emoji work: the naive browser approach throws on both.
How to use the base64 encoder
Base64 turns three bytes into four printable characters, making it about a third larger than what went in. That third is real where it costs you: on disk, in memory, and in the time something takes to parse. Over the wire it largely is not, because the encoded text uses only 64 symbols and gzip compresses almost all of the expansion back out, so a Base64 payload inside a compressed response is not costing you a third of the transfer, whatever the arithmetic suggests. Judge it on parsing and memory, not bandwidth.
The arithmetic itself is worth knowing for sizing a field. Every three bytes become four characters. A single leftover byte becomes two characters plus ==; two leftover bytes become three plus =. So "Hi". Two bytes. Encodes as SGk=, and any padded Base64 string has a length that is a multiple of four.
The URL-safe variant swaps + and / for - and _ and drops the padding, because the standard alphabet does not survive a URL or a filename intact. It is the same encoding underneath; only the alphabet changes.
Two practical notes. Base64 is an encoding, not encryption: anyone can reverse it instantly, so encoding a password or a token protects nothing at all. And the output here is one unbroken line: MIME historically wrapped Base64 at 76 characters, and a few older decoders still expect those breaks, though nothing in a URL, a header or a JSON field wants them.
Questions
No. It is an encoding and anyone can reverse it instantly. It offers no protection whatsoever.
Three bytes become four characters, so the output is about a third larger. That cost is real on disk and in memory; over a gzipped connection most of it compresses back out.
SGk=. Two bytes do not fill a three-byte group, so one padding character closes it.
The same encoding with + and / replaced by - and _, and padding dropped, so it survives a URL or filename.
Not for a URL, a header or a JSON field. MIME wrapped at 76 and a few old decoders still expect it; this produces one unbroken line.
Because btoa works on Latin-1 and throws above U+00FF. Encoding the UTF-8 bytes first fixes it, which is what this does.
No. It is encoded in your browser.