Encoding Is Transport Formatting — Never Encryption
Anyone with a Base64 decoder can read encoded text immediately. Use Base64, Base64URL, URL percent-encoding, and HTML escaping only to move bytes safely through text protocols, query strings, or markup — never to hide secrets.
Picking the Right Encoder
- Standard Base64: Uses
+,/, and=padding. Safe inside JSON strings, MIME headers, and HTTP Basic Authorization headers. - Base64URL (RFC 4648 §5): Uses
-and_without=padding. Required for JWTs, OAuth PKCE challenges, and URL query tokens. encodeURIComponent()vsencodeURI(): UseencodeURIComponent()for individual query values so&,=, and+are escaped. UseencodeURI()only on complete URLs.- HTML Entities: Escapes the five special characters and decodes the full HTML 4 set of named (
…,€,™) and numeric/hex (A) entities safely using a pure Map lookup with zeroinnerHTML.
Limits
All encoding and decoding runs inside a background Web Worker with a 5 MB safety cap and a Cancel button so large strings never freeze the browser tab.