URL-safe Base64 variant: replaces + / = with - _ and removes padding
Base64URL is the "URL-safe" variant of Base64, designed for transmission in URLs, file names, cookies and similar contexts. In standard Base64, + and / get escaped in URLs (becoming %2B and %2F), and the = padding often causes ambiguity.
Base64URL makes three substitutions: + → -, / → _, and removes trailing = padding. The result can be placed directly into a URL parameter without extra encoding. It is widely used in JWT (JSON Web Token), OpenID Connect, OAuth and similar protocols.
Input: Hello World
Standard Base64: SGVsbG8gV29ybGQ=
Base64URL: SGVsbG8gV29ybGQ
+ ↔ -, / ↔ _, and add or remove = padding per length. The underlying data is identical.+ / = prevents URL encoding from breaking the structure, ensuring the token parses reliably across environments.