What base64 is for
Base64 encodes binary data into 64 printable ASCII characters so it survives text-only channels: email attachments (MIME), HTTP Basic auth (user:pass), data URIs in CSS/HTML (data:image/png;base64,...), and the base64url segments of JWTs. Every 3 bytes become 4 characters, so output is ~33% larger than input.
Standard vs URL-safe
- Standard base64 uses
+/and=padding — fine in bodies and headers, but+and/have special meaning in URLs. - base64url swaps
+→-and/→_, and usually drops padding — this is what JWT segments and?token=params use. - The tool auto-detects and decodes both forms; the checkbox controls the encode output.
Unicode note
Text is encoded as UTF-8 first, so emoji and CJK work correctly both ways — a common bug with naive encoders that mangle non-ASCII input.
Pair with the JWT Decoder if you're working with tokens (all three segments are exactly base64url).
Edge cases and hard limits
Text and Base64 are converted through bytes rather than through btoa alone, because btoa rejects anything above code point 255. utf8ToB64() encodes the string to UTF-8 bytes first, builds a binary string from them and only then base64-encodes; b64ToUtf8() reverses it with atob and a TextDecoder, so a Chinese character or an emoji survives the round trip instead of throwing an invalid-character error.
Formats, sizes and other limits
The encoding is standard Base64 with padding, not the URL-safe alphabet — a value containing + or / will break if placed in a query string. Whitespace inside the input is stripped before decoding, which is convenient for copied block text and dangerous if the whitespace was meaningful. Very large strings hit the argument limit of the binary-string construction, so multi-megabyte payloads belong in the file variant of the tool.
Privacy: processed in your browser
The string is converted to bytes and back inside this tab using the browser’s own encoder; nothing is transmitted, so a token you are debugging does not leave the machine.
Frequently asked questions
Why does Chinese text fail elsewhere?
Because plain btoa only handles Latin-1. This page converts to UTF-8 bytes first, which is why CJK and emoji survive.
Is it URL-safe Base64?
No. Standard alphabet with + and /. If the value goes into a query string, use the URL encoder instead.
Can it decode a JWT payload?
It can decode the middle segment once you remove the URL-safe substitutions (- to +, _ to /). The JWT decoder does that for you.