·data
Base64 Encoder / Decoder
Bidirectional text ↔ base64. Standard and URL-safe variants, one-click direction swap. UTF-8 safe (handles non-ASCII characters).
base64 · encoding · web
JWT parts, data URIs, image embedding, basic auth headers — base64 is everywhere. This lab does instant text ↔ base64 conversion with URL-safe variant support.
base64 · 20 B · +43% overhead
SGVsbG8sIEJhc2U2NCE=
Standard vs URL-safe
| Char | Standard | URL-safe |
|---|---|---|
+ | + | - |
/ | / | _ |
= (padding) | required | dropped |
URL-safe is defined in RFC 4648 §5. Cookie values, URL paths/queries, JWT headers all need it because + and / are reserved characters.
UTF-8 trap
btoa("é") → InvalidCharacterError, because btoa expects Latin-1 (8-bit). For UTF-8 strings, encode to bytes via TextEncoder.encode() first, then base64. The lab does this automatically — Turkish, Chinese, emoji all work.