About the Base64 Encode/Decode
Base64 (RFC 4648) represents binary data with 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = padding. Every 3 input bytes become 4 output characters, so encoded data is about 33% larger. It is an encoding, not encryption: anyone can decode it.
The browser functions btoa() and atob() only accept Latin-1, so btoa('é') throws or garbles multi-byte text. This tool first converts text to UTF-8 bytes with TextEncoder, so Café ☕ encodes to Q2Fmw6kg4piV exactly as Node's Buffer.from(s).toString('base64') would. The decoder accepts both alphabets, ignores whitespace and tolerates missing padding.
URL-safe (Base64url) swaps +/ for -_ and drops padding, as used in JWTs and URL parameters. MIME wrapping breaks lines at 76 characters as required by RFC 2045 for email bodies. Use Encode a file to turn an image, PDF or certificate into Base64; everything is processed locally and nothing is uploaded.
How to use it
- Choose Encode or Decode.
- Type or paste your text, or click “Encode a file…” to load a file.
- Tick URL-safe or MIME wrapping if your target needs it.
- Copy the result, or use ⇄ Swap to reverse the conversion.
Frequently asked questions
Why does btoa() fail with “The string to be encoded contains characters outside of the Latin1 range”?
btoa(String.fromCharCode(...new TextEncoder().encode(s))), or use this tool, which does that for you.