Decoding vs verifying a JWT: why a readable token proves nothing

Decoding shows you what a token says. Verifying tells you whether to believe it. Never make an access decision from decoded claims alone.

A JWT looks scrambled, but it isn't encrypted. The header and payload are plain JSON written in Base64url, so any decoder can read them without a key. Verifying is a separate step. It recomputes the signature with the issuer's secret or public key and checks that it matches the token. Only that second step tells you the claims came from the issuer and weren't changed on the way.

By TechCompare · Updated

Topic
Decode vs verify
Signature verification
Category
Fundamentals
How JWTs are built and read

How this is calculated

Every JWS token has three parts: header, payload and signature. Decoding reverses the Base64url encoding of the first two parts and parses the JSON. That's it. No key is involved, which is why a browser extension, a log viewer or this page can show you a token's claims instantly. Verification works on the exact text of the first two parts. The verifier joins them with a dot, runs the algorithm from an allowlist it chose itself (HMAC with SHA-256 for HS256, RSA PKCS #1 v1.5 for RS256, ECDSA for ES256), and compares the result with the signature part. If a single character of the header or payload changes, the check fails. The catch is that the payload is under the sender's control. A forged token can say "role": "admin" just as easily as a real one. Front ends often decode a token to show a user's name or to know when to refresh it, and that's fine, since the server verifies it again on every request. The mistake is a server or an API gateway that decodes and trusts. The JWT Decoder keeps the two apart on purpose: it labels every token Unverified until a real Web Crypto signature check passes for the token and key on screen.

Verdict

Decode freely for debugging and for display. Verify on the server for anything that grants access, and do it with a key you got from the issuer, never one the token points to. Once the signature passes, the work isn't done: check exp and nbf, check that iss and aud match what your service expects, then check the scopes or roles for the action.

More JWT scenarios

Frequently asked questions

Can I decode a JWT without the secret?
Yes. The header and payload are only Base64url encoded, not encrypted, so anyone can read them. The secret or public key is only needed to verify the signature. If the contents themselves have to stay private, the issuer needs an encrypted token (JWE) instead.
Is it bad that anyone can read my JWT?
Not if you plan for it. Keep secrets, passwords and personal data you wouldn't put in a URL out of the payload. A user ID, issuer, audience, expiry and scopes are normal things to carry, since the signature stops anyone from changing them.
Should my front end verify the token?
It can't do it in a useful way. With HS256 the browser would need the shared secret, which would then be public. The front end can decode a token to read the expiry or a display name, and the API must verify it on every request.