How to Decode a JWT and Verify Its Signature (Safely)
What is inside a JSON Web Token, how to read its claims and expiry, and how to verify the signature locally without sending the token anywhere.
JSON Web Tokens (JWTs) are used by most modern login systems and APIs. When something goes wrong — a request is rejected, a session expires too early, a role is missing — the first step is to look inside the token.
What a JWT contains
A JWT has three parts separated by dots: header.payload.signature.
- Header — the signing algorithm, such as HS256 or RS256.
- Payload — the claims: who the user is (
sub), when the token was issued (iat), when it expires (exp), and any custom data like roles. - Signature — proof that the header and payload were created by someone holding the key and have not been changed.
The header and payload are only Base64URL-encoded, not encrypted. Anyone with the token can read them, which is why tokens should never contain passwords or other secrets.
How to decode a JWT
- Open the JWT Decoder and paste the token (a leading "Bearer " is removed automatically).
- Read the decoded header and payload. The
exp,iatandnbftimestamps are shown as readable dates, with an expired / valid badge. - To verify the signature, enter the shared secret for HS256/384/512, or a PEM public key for RS, PS and ES algorithms.
Decoding and verification use your browser's Web Crypto API, so the token and key are never transmitted.
Troubleshooting "invalid signature"
- The secret or public key does not match the one used to sign the token.
- The token was modified after it was signed.
- The HMAC secret is stored Base64-encoded — switch the secret format to Base64.
Timestamps in JWTs are Unix seconds; to convert one by hand, use the Unix Timestamp Converter.
Frequently Asked Questions
Can anyone read a JWT?
Yes. The header and payload are Base64URL-encoded, not encrypted, so anyone with the token can read them. The signature only proves the token has not been altered.
How do I check when a JWT expires?
Decode it and look at the exp claim, which the decoder shows as a readable date together with an expired or valid status.
Is it safe to paste a token into a decoder?
With this decoder the token is processed only in your browser. As a rule, avoid pasting live production tokens into sites you do not control, and rotate any secret you think was exposed.
Can it decode encrypted tokens (JWE)?
No. Encrypted JWE tokens have five parts and need the private key; this tool decodes signed JWS tokens with three parts.
