What Base64 is for
Base64 turns arbitrary bytes into 64 safe characters (A–Z, a–z, 0–9, + and /), so binary or special-character data can travel through systems that only expect plain text. You will see it in HTTP Basic authentication headers, data: URLs for images, email attachments, Kubernetes secrets, and the three parts of a JWT.
Base64 is an encoding, not encryption. Anyone can decode it, so never treat a Base64 value as hidden. It also makes data about a third larger: every three bytes become four characters, with = padding at the end when the input length is not a multiple of three.
Why UTF-8 handling matters
The browser's built-in btoa() only accepts characters in the Latin-1 range, so encoding "café" or "日本" directly throws an error, and naive workarounds produce strings other systems decode as garbage. This tool encodes text as UTF-8 bytes first, which is what servers, command-line tools such as base64 on Linux and macOS, and most programming languages expect.
Base64 vs Base64URL
Base64URL is a variant that swaps + for - and / for _, and usually drops the = padding, so the result can sit in a URL or file name without escaping. JWTs use Base64URL. If a decoder rejects a string full of - and _ characters, it is probably Base64URL: replace them with + and /, add = until the length is a multiple of four, and decode again.