Base64 vs Base64URL
Base64URL is a URL-safe variant used in JWTs and query strings.
- Standard Base64 uses + and /.
- Base64URL replaces them with - and _.
- Base64URL may omit = padding.
// Convert Base64URL -> Base64
const b64 = b64url.replace(/-/g, '+').replace(/_/g, '/');
const padded = b64.padEnd(Math.ceil(b64.length / 4) * 4, '=');If decoding fails, first normalize URL-safe characters and restore padding.
Related: Invalid character fix · Base64 tool
Continue with related guides
Browse the full guides hub or open the Base64 encode/decode tool.