Guide
Reading a JWT, and debugging 401 errors with it
A JSON Web Token (JWT) is three Base64URL-encoded parts separated by dots: header.payload.signature. APIs and login systems use JWTs to say who you are and what you can do. When an API call fails with 401 Unauthorized, decoding the token is usually the first debugging step. This decoder shows what’s inside, with dates you can read, without sending the token anywhere.
Decoding a token
- Paste the token, with or without the
Bearerprefix copied from an Authorization header. - Read the header and payload as formatted JSON; copy either one.
- Check the expiry notice: expired, or not expired yet, with the time in your time zone.
- Look at Dates in the payload for the issue time, not-before time and others.
If the token is malformed, you get a specific message: either it doesn’t have dot-separated parts, or a part isn’t valid Base64URL-encoded JSON, often because the token was cut off while copying.
The three parts
| Part | Contains | Readable by anyone? |
|---|---|---|
| Header | Token type and signing algorithm (alg), sometimes a key ID (kid) |
Yes |
| Payload | Claims: who the token is for, who issued it, when it expires, permissions | Yes |
| Signature | Proof that header and payload weren’t changed | Verifiable only with the key |
Because the payload is readable, never put secrets in it: no passwords, no internal data you wouldn’t show the user.
The claims you’ll check most
| Claim | Meaning |
|---|---|
exp |
Expires at (seconds since 1970). After this, the token must be rejected. |
iat |
Issued at. |
nbf |
Not valid before this time. |
sub |
Subject, usually the user ID. |
aud |
Audience: which API or app the token is for. |
iss |
Issuer: who created the token. |
Time claims are Unix timestamps in seconds. The decoder converts them for you; for other timestamps, use the Timestamp Converter.
Debugging “401 Unauthorized”
- Expired? Check the expiry notice. Expired tokens are the most common cause; the client should refresh them.
- Not yet valid? An
nbforiatin the future points to clock problems. - Wrong audience or issuer? Compare
audandisswith what the API is configured to accept, such as a staging token sent to production. - Clock skew: a server clock a few minutes off can make fresh tokens look expired or not yet valid. Servers usually allow a small leeway.
- Transport: confirm the header is
Authorization: Bearer <token>with no extra quotes or line breaks.
Decoding is not verifying
Decoding reads the contents; it doesn’t prove the token is genuine. Anyone can create a token with any payload. Only checking the signature with the issuer’s secret or public key proves it’s authentic. That check belongs in your server code, using a maintained JWT library that:
- accepts only the algorithms you expect, never
none; - checks
exp,nbf,audandiss; - gets public keys from the issuer’s trusted key set.
The decoder shows the alg value from the header so you can see which algorithm the token claims to use.
Privacy
The token is decoded in your browser and never sent anywhere. Even so, a valid token lets anyone act as its user until it expires, so avoid sharing live tokens in screenshots, tickets or chats.
Who decodes JWTs
- Backend and frontend developers debug login and API authorization.
- QA engineers check which roles and permissions a test user’s token carries.
- Security engineers review token contents and lifetimes.
- Support engineers check whether a customer’s token has expired.
A complete example: a user can’t access an admin page
- Copy the user’s token from the request’s Authorization header in developer tools.
- Decode it and check the payload for a role or scope claim, such as
"role": "editor". - If the role is missing, the problem is in how the token was issued, not the page.
- Check
exptoo: an expired token gives a similar error.
Tips
- Use test accounts’ tokens when sharing screenshots.
- Never paste signing secrets into any website.
Related tools
- Timestamp Converter for Unix times in logs and claims.
- Base64 Encoder to decode a single Base64URL part by hand.
- JSON Formatter to explore large payloads.
Checked against the current version of the JWT Decoder on .

