Why native btoa() breaks on Unicode (and how this tool avoids it)
If you open a browser console and run btoa("café") or btoa("🚀"), JavaScript throws an InvalidCharacterError because btoa() only accepts single-byte Latin-1 characters. Plenty of quick Base64 web pages wrap btoa() directly and break the moment you paste a UTF-8 JSON payload or a non-English name.
This converter encodes text through new TextEncoder().encode(value) before converting bytes to Base64, and restores decoded bytes through new TextDecoder("utf-8"). That means emojis, accented characters, and multi-byte scripts round-trip cleanly. Hit Swap Input & Output after encoding to verify that your exact original text comes back untouched.
Standard Base64 versus Base64URL in JWTs and OAuth
Standard Base64 (RFC 4648 Section 4) uses +, /, and trailing = padding. Put those characters inside a query string and HTTP servers turn + into a space or treat / as a path separator. Base64URL (RFC 4648 Section 5) swaps + for -, swaps / for _, and drops the trailing = padding.
Check the URL-Safe (Base64URL) box when encoding JWT headers, OAuth state parameters, or URL tokens. In Decode mode, this tool accepts both standard Base64 and unpadded Base64URL automatically, so you can paste the middle segment of a JWT directly into the input box and read the JSON claims without manually adding = signs.
Everyday debugging tasks for local Base64 conversion
- Decoding Kubernetes Secret values from YAML manifests without sending production environment variables to a remote server.
- Building HTTP Basic Auth headers (
Authorization: Basic ...) fromusername:passwordwithout the trailing newline thatecho "user:pass" | base64accidentally sneaks in. - Converting a small SVG icon or 2 KB PNG into a Base64 string via the Choose File button at the bottom of the workspace. Keep in mind Base64 inflates binary size by about 33%, so avoid inlining large images.
Remember that Base64 is encoding, not encryption. Anyone who sees a Base64 string can decode it immediately. If you need integrity hashes for decoded payloads, use our SHA-256 Hash Generator; if you need unpredictable secret keys, use our Random Token Generator.