Security • Published August 20, 2026

Base64url vs Standard Base64: RFC 7515, JWTs & URL-Safe Encoding Explained

Learn why Base64url is required for JSON Web Tokens (JWT) and URLs. Understand character substitutions (+ to -, / to _), padding omissions, and code examples.

Detailed guide to Base64url (RFC 7515 & RFC 4648): why standard Base64 breaks in URLs, character replacements (+ to - and / to _), unpadded strings, and JWT implementations.

Frequently Asked Questions

Q1. Why does standard Base64 break in URL query parameters?

In URL query parameters, "+" represents a whitespace space character, and "/" indicates a path separator, corrupting the original Base64 payload.

Q2. How do I decode Base64url in JavaScript?

Replace - with +, _ with /, and add padding = until the string length is divisible by 4, then call atob().