Tools / Base64
Base64 and Base64url encoder and decoder
Text is converted to UTF-8 bytes with TextEncoder before encoding, so non-ASCII text and emoji round-trip correctly. Decoding accepts either alphabet, with or without padding.
Examples:
How it works
Every three bytes become four characters from a 64-character alphabet. The standard alphabet ends in + and /. Base64url (RFC 4648, section 5) uses - and _ instead, so the result can sit in a URL or a filename without escaping. JWTs use Base64url without padding.
Pitfalls
btoa() only accepts characters below U+0100. It throws on btoa("€") and silently mangles text that was not converted to bytes first. This page always goes through TextEncoder.
A decoded result is a sequence of bytes, not necessarily text. When the bytes are not valid UTF-8, for example a compressed blob or a key, the tool says so and shows the first bytes in hex rather than printing replacement characters.
Whitespace and line breaks are ignored when decoding, because MIME wraps Base64 at 76 characters. A length that leaves one character over can never be valid. Mixing + with - in one string usually means two values were concatenated.