JWT Decoding vs Verification

Decoding a JWT just base64url-decodes its header and payload into JSON — no key, no proof of authenticity. Verification recomputes the signature over the exact header+payload bytes and checks it against the expected key/algorithm, plus validates time-based claims like exp/nbf.

Updated: 2026-08-11

What decoding gives you

Any JWT can be decoded by anyone: split the string on '.', base64url-decode the first two segments, and you have the header and payload as plain JSON.

This is exactly why a JWT payload must never contain data an untrusted holder shouldn't see — decoding requires no secret at all.

What verification adds

Verification recomputes the signature using the algorithm from the header and the issuer's key, then compares it byte-for-byte against the token's signature segment.

A correct verifier also enforces claims that decoding alone can't validate: exp (not expired), nbf (not used too early), and often iss/aud (issued by/for the expected party).

If verification is skipped, an attacker can hand-craft any payload, base64url-encode it, and it will decode 'successfully' with whatever claims they chose.

The alg: none pitfall

Some early JWT libraries would treat a token as verified if its header declared alg: none and the signature segment was empty — always pin the expected algorithm(s) on the verifier side rather than trusting the token's own header.

Engineering Notes

i
"I can see the claims in the debugger, so the token is valid" is the single most common JWT security mistake — decoding and verification are different operations.
i
Always verify server-side with a fixed allow-list of algorithms; never derive the algorithm to use from the incoming token.

Related Concepts

JWT

Related Tools

Related Reference