Base64, Base64URL & URL Codec

UTF-8 safe Base64, URL-safe Base64URL, and encodeURIComponent / decodeURIComponent converter.

How It Works & Reference

Choose Base64 for standard binary-to-text, Base64URL for JWT/OAuth tokens (replaces +/ with -_ and strips =), or URL Component for query string parameters.

Base64 vs Base64URL vs URL Encoding

EncodingSpecial CharsPaddingTypical Use
Base64+ and /= / ==Data URIs, email, Basic Auth
Base64URL- and _OmittedJWT segments, OAuth2 PKCE
URL Component%XX hexNoneQuery string values (?q=...)

Frequently Asked Questions

Why does standard window.btoa fail on Chinese or emoji?

btoa only accepts Latin1 bytes. This tool encodes strings via TextEncoder UTF-8 first so Chinese and emojis always work.

What is the difference between Base64 and Base64URL?

Base64URL replaces + with -, / with _, and omits trailing = padding so it can sit safely inside URLs.

Should I use encodeURI or encodeURIComponent?

For query parameter values, use encodeURIComponent (used here) so &, =, and ? inside values are properly escaped.

Related Tools