Skip to content
100% in your browser. Nothing you paste is uploaded — all processing runs locally. Read more →

Base64url (URL-safe)

Encode and decode Base64URL, the URL-safe Base64 variant defined in RFC 4648 §5, right in your browser. It swaps + and / for - and _ so the result can sit in a URL or filename, and the Strip padding option drops the trailing = the way JWTs do. Nothing is uploaded and no account is needed.

🔒 100% client-side · no upload · no account

The two characters that change

Standard base64Base64url
Position 62+-
Position 63/_
Padding (=)Included unless the referring spec says otherwise (RFC 4648 §3.2)Same rule (§3.2). JWS omits it (RFC 7515)

The 62 alphanumeric characters at positions 0–61 are identical in both variants. RFC 4648 changes only the last two alphabet characters.

Padding is not part of the difference. RFC 4648 §3.2 sets one padding rule for both alphabets, covered below.

Where base64url is used

Translating between variants

Two-line conversion in any language:

// Standard → URL-safe
b64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");

// URL-safe → Standard
b64url.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - b64url.length % 4) % 4);

The bytes encoded are identical; only the surface alphabet differs. A decoder that handles both should normalize URL-safe to standard before calling atob().

Padding: keep it or strip it?

Padding (=) makes the length a multiple of 4. RFC 4648 §3.2 says implementations must include that padding unless the referring specification says otherwise. §5 only notes that = may be skipped when the data length is known implicitly. For signed JWTs (JWS), RFC 7515 is the spec that says to omit the trailing =. Other systems may insist on it.

The 'Strip padding (=)' box on this page starts unticked, so the default output keeps the =. Tick it when you want the unpadded form a signed JWT uses.

Convention: strip for JWT and URLs, keep for everything else unless told otherwise. Most decoders accept both.

Common pitfalls

FAQ

What makes base64url 'URL-safe'?

Standard base64 uses + and /, both reserved in URL syntax — + means 'space' in query strings, / is a path separator. Base64url replaces them with - and _ respectively, so the encoded value can sit in a URL without further encoding.

Is padding still used?

RFC 4648 §3.2 says implementations must include = padding unless the referring specification says otherwise. §5 only notes that = may be skipped when the data length is known implicitly. RFC 7515 (JWS) is the spec that says to omit the trailing = for signed JWTs. The 'Strip padding (=)' box starts unticked, so the default output keeps that padding. Tick it to drop the trailing =.

Can I encode a JWT with this?

You can encode parts of a signed JWT (header or payload). Tick 'Strip padding (=)' so the result drops the trailing = the way a JWS does. That box starts unticked, so the default output is not what a signed JWT uses. For full JWT signing/verifying, use our JWT decoder instead.