Decode a JWT: Read Claims and Verify the Signature
Short answer: to decode a JWT, split it at the dots and Base64URL-decode the first two parts. You need no key for that, which is exactly why a decoded token proves nothing. Paste it into the JWT Decoder to read the header, the claims and the expiry in one go, then verify the signature with the right key before you trust a single claim.
What is inside a JWT
A JSON Web Token (RFC 7519) is three pieces joined by dots: header.payload.signature.
- The header says how the token was signed, for example
{"alg":"HS256","typ":"JWT"}. - The payload carries the claims: who the token is about (
sub), who issued it (iss), who it is meant for (aud), and three time claims,iat,nbfandexp. - The signature is computed over the first two parts with a secret or a private key.
The header and payload are only Base64URL-encoded JSON. Encoded is not encrypted. Anyone who holds the token can read every claim in it, so never put anything in a JWT that the holder should not see.
Decoding is not verifying
This is the one idea to take away. A forged token decodes just as cleanly as a real one, because producing the payload needs no key. Only the signature check tells you whether the token was signed by someone holding the right key and whether it was changed afterwards.
Even a valid signature has limits. It shows the token was not altered. It does not show that the token has not been revoked, and it does not hide the contents.
Reading the claims that matter
| Claim | Meaning | What to look at |
|---|---|---|
exp |
Expiry time | A token past this moment must be rejected |
nbf |
Not before | A token used before this moment must be rejected |
iat |
Issued at | Should not be in the future |
iss |
Issuer | Must be the issuer you expect |
aud |
Audience | Must include your service |
sub |
Subject | Who the token is about, usually a user ID |
The three time claims are numbers of seconds since 1 January 1970 UTC. A frequent bug is a service that writes milliseconds there: the date lands thousands of years in the future and the token seems to live forever. The decoder flags dates that look like milliseconds. If you need to translate a raw number yourself, the Unix Timestamp Converter does it, and the guide on seconds versus milliseconds explains the mix-up.
The alg: none and algorithm-confusion traps
Two header-related mistakes show up again and again in real systems:
alg: nonemeans the token claims to need no signature. A service must never accept such a token as proof of identity. The decoder reports it in its claim checks.- Algorithm confusion happens when a server expects an RSA signature but lets the token choose its own algorithm. An attacker sets
HS256and signs with the server's public key, which is public by definition, and a sloppy library accepts it. The decoder warns when an HMAC token is checked against something that looks like a public key. The fix is on the server: decide the allowed algorithms yourself and never read them from the token. RFC 8725 (JWT Best Current Practices) covers this in detail.
JWT or JWE?
A normal signed token has three parts. A token with five parts is a JWE, an encrypted token. It cannot be read without the key, and the decoder does not decrypt it. If you only see random bytes after the first dot, count the parts before you assume something is broken.
How to decode a JWT with the JWT Decoder
- Open the JWT Decoder and paste the token.
- Read the decoded header and payload. The
iat,nbfandexpvalues are turned into readable dates, and the token's lifetime (expminusiat) is shown. - Open Verify signature. Enter the shared secret for HS256/384/512, or a public key (PEM, JWK or a JWKS) for RS256/384/512, PS256/384/512, ES256/384/512 and EdDSA (Ed25519). EdDSA needs a browser with Ed25519 in WebCrypto, and the tool tells you if yours lacks it.
- Look at the Claim checks. They report an expired
exp, a not-yet-validnbf, aniatin the future, a missingexp, dates in milliseconds andalg: none. Type an expected issuer or audience to have them compared, and use the clock-skew box to allow for a small difference between machines. - Set a lifetime limit in days if you want long-lived tokens flagged. That warning is a rule of thumb, not an error. A token that lives 76 years, as the built-in example does, deserves a second look.
To make a token for testing, use the JWT Generator (see how to create a test JWT). It signs with the same algorithms in your browser, and the public key it gives you is what you paste into the decoder.
Limits to know
- Time checks use your device's clock. They cannot tell whether a token has been revoked.
- JWE tokens are not decrypted, and algorithms outside the list above cannot be verified.
- A decoded token is only as trustworthy as the key you verified it with. You supply the key yourself (secret, PEM, JWK or JWKS).
- The tool runs in your browser and does not send the token anywhere. A live token can still grant access until it expires, so prefer test tokens and never share a real one in a chat or ticket.
Frequently asked questions
How do I decode a JWT? Paste it into the JWT Decoder. It decodes the header and payload and shows the expiry. No key is needed for that step.
Is a JWT encrypted? No. A standard signed JWT is only encoded, so anyone can read its claims. Only a five-part JWE is encrypted.
Why does my JWT say "expired"?
The exp claim is earlier than the current time, with the clock-skew allowance applied. Check the device clock too, and make sure exp is in seconds, not milliseconds.
Is it safe to paste a production token into an online decoder? This one decodes locally. Still, a live token is a credential until it expires. Prefer test tokens, and rotate or revoke anything that was pasted somewhere it should not have been (see what to do after a leak).
What does alg: none mean?
That the token claims to need no signature. Reject it.
Can I verify an RS256 token with a JWKS? Yes. The tool accepts a JWKS as the key, along with a secret, a PEM public key or a single JWK.
Related tools and guides
- Create a test JWT: HS256, RS256, ES256 and EdDSA
- JWT Generator & Signer for test tokens
- Unix Timestamp Converter for
exp,iatandnbf - Base64 Encoder & Decoder to see the Base64URL parts by hand (see Base64 is not encryption)
- HMAC Generator: HS256 signatures are HMAC-SHA-256 (see MD5 vs SHA-256 vs SHA-3 vs BLAKE2)
- X.509 Certificate Inspector for the keys behind RS and ES tokens (see How to decode a PEM certificate)
- Secret Scanner to check code for committed tokens