Dev Tools · 1h ago
Fix Base64URL decoding errors in JWTs with this simple function
Developers often hit DOMException when using atob() on JWT segments because JWTs use Base64URL, not standard Base64. Base64URL replaces + with -, / with _, and omits padding. A short normalize-and-pad function converts Base64URL to standard Base64 before decoding.
Meridian48 take
A common gotcha that wastes developer hours — this fix is trivial but rarely documented clearly.
Read the full reporting
atob() can't decode a JWT — the Base64URL gotcha (and the fix) →
DEV Community
jwtbase64url