How to Decode a JWT Safely (Without Leaking Your Tokens)
A JWT is not encrypted — anyone can read its header and payload. Learn how to decode one, what claims like exp and iat mean, and why you should never paste production tokens into random online decoders.
A JSON Web Token (JWT) looks like a solid block of scrambled text, so it is easy to assume it is encrypted. It is not. A JWT is encoded, not encrypted — anyone who has the token can read most of what is inside it. That is exactly why knowing how to decode one safely matters: the same trick you use to debug your own login flow is available to anyone a token leaks to.
The three parts of a JWT
Every JWT has three sections separated by dots:
header.payload.signature
- Header — a small JSON object saying what the token is (
"typ": "JWT") and which algorithm signed it ("alg", for exampleHS256orRS256). - Payload — a JSON object carrying the claims: the actual data of the token, such as who it was issued to and when it expires.
- Signature — a cryptographic check produced with a secret or private key. This is the only part that protects the token, and it protects against tampering, not against reading.
The header and payload are simply Base64URL-encoded JSON. Decoding them takes seconds — no key required.
How to decode a JWT, step by step
- Split the token at the dots into its three parts.
- Base64URL-decode the first part to read the header and confirm the signing algorithm.
- Base64URL-decode the second part to read the payload claims.
- Check the time claims (below) against the current time before you trust anything else.
- Remember what decoding does not do: it does not verify the signature. A decoded token tells you what the token says, not whether it is genuine. Verification always has to happen on your server, with the proper key.
You can do all of this with the free Kriyano JWT Decoder — more on why the tool you choose matters in a moment.
The claims you will actually meet
Payloads use short, standardised claim names. The ones you will see most often:
| Claim | Name | What it means |
|---|---|---|
iss |
Issuer | Who issued the token, usually your auth provider or API. |
sub |
Subject | Who the token is about, typically a user ID. |
aud |
Audience | Who the token is intended for, such as your API’s identifier. |
exp |
Expiry | When the token stops being valid, as a Unix timestamp. An expired token should be rejected. |
iat |
Issued at | When the token was created, as a Unix timestamp. |
nbf |
Not before | The token must not be accepted before this time. |
Two practical debugging tips follow from this. First, if users report being logged out unexpectedly, decode a fresh token and compare exp with the current time — clock skew and short lifetimes are the usual culprits. Second, never put sensitive data in the payload: no passwords, no personal details you would not want read aloud. Because the payload is readable by anyone holding the token, treat everything in it as public.
The safety rule: never paste production tokens into random decoders
Here is the part that is easy to get wrong. Many online JWT decoders send your token to a server for processing, log requests, or run third-party scripts on the page. If you paste a live production token into one of those, you may have just handed a working credential — valid until exp — to a stranger’s infrastructure. Session tokens and API tokens get stolen exactly this way.
Follow these rules instead:
- Never paste a real production token into a decoder you do not control. Revoke or rotate any token you have already pasted somewhere untrusted.
- Use test tokens for debugging whenever you can: generate a sample token in your staging environment instead of copying one from a real user’s session.
- Prefer a decoder that runs locally. The Kriyano JWT Decoder processes everything in your browser — the token never leaves your machine, nothing is uploaded, and no account is needed. You can confirm this yourself by loading the page, disconnecting from the network, and decoding a token offline.
- Still verify on the server. Local decoding is for inspection and debugging only; your backend must always check the signature, expiry and audience before trusting a token.
The short version
A JWT’s header and payload are readable by design, the signature only proves the token was not altered, and exp is the claim to check first when something stops working. Decode tokens to debug — but decode them with a tool that keeps them on your own machine.
If you work with AI assistants while debugging auth issues, the same caution applies to what you share with them; our guide to where AI can go wrong covers how to sanity-check technical output before you act on it.