Skip to main content

Base64, URL & HTML Encoder / Decoder

UTF-8 and emoji-safe Base64 and RFC 4648 §5 Base64URL, URL component and parts parser, HTML entity escaping, and local unverified JWT inspection.

By Lasita Engineering TeamLast reviewed: Examples verified by hand & automated test suite

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() vs encodeURI(): Use encodeURIComponent() for individual query values so &, =, and + are escaped. Use encodeURI() 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 zero innerHTML.

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.

Frequently Asked Questions

What is the difference between Base64 and Base64URL?

Standard Base64 uses +, /, and = padding. Inside a URL query string, + is commonly decoded as a space and / looks like a path separator. Base64URL (RFC 4648 §5) replaces + with -, / with _, and omits = padding, making it safe for URLs and required for JWT headers and payloads.

Does the JWT decoder verify token signatures?

No. It decodes the Base64URL header and payload locally in your browser (automatically removing a leading "Authorization:" or "Bearer " and surrounding quotes) so you can inspect claims and exp/iat timestamps safely. Signature verification always requires your key on a trusted server.

Why do emoji or BOM characters break some browser encoders?

window.btoa() only accepts Latin-1 characters and throws on emoji, while default TextDecoder() strips leading UTF-8 BOM marks. Lasita runs a UTF-8 byte codec with ignoreBOM enabled inside a background Web Worker so emoji and BOM characters round-trip losslessly.

Read the full engineering reference: Practical Reference for Everyday Developer Data: JSON, Regex, Unix Timestamps, Base64 & WCAG Contrast →