In this article
The three parts
A JWT looks like three blocks of letters joined by dots: xxxxx.yyyyy.zzzzz.
- Header – which algorithm signed the token, e.g.
{"alg":"HS256","typ":"JWT"}. - Payload – the claims: who the user is, roles, and when the token expires.
- Signature – proof that the server created the token and nobody changed it.
The header and payload are only Base64URL-encoded, not encrypted. Anyone holding the token can read them. The signature stops people changing them, not reading them.
Standard claims
| Claim | Meaning |
|---|---|
sub | Subject – usually the user ID |
iss | Issuer – who created the token |
aud | Audience – which app it is meant for |
exp | Expiry time (Unix seconds) |
iat | Issued at |
nbf | Not valid before |
How to decode a token
- Copy the token – often from the browser’s developer tools (Network or Application tab) or an Authorization header.
- Paste it into the JWT Decoder; a “Bearer ” prefix is removed automatically.
- Read the pretty-printed header and payload. Time claims are shown as local dates with a status: valid, expired or not yet valid.
- If you have the secret for an HS256/384/512 token, enter it to verify the signature.
Debugging common login problems
- Logged out too soon: compare
expwithiat. A token valid for 300 seconds instead of 300 minutes is a classic unit mistake. - “Invalid audience” or “invalid issuer”: check
audandissagainst your server configuration. - Token not yet valid: a device clock that is ahead or behind causes
nbfandexpproblems. Check the computer’s time. - Missing permissions: look for role or scope claims in the payload.
Where tokens are stored
Web apps keep tokens in cookies, localStorage or memory. Cookies marked HttpOnly cannot be read by JavaScript, which protects them from many cross-site scripting attacks; tokens in localStorage are easier to use but more exposed if a site has a script injection flaw. Mobile apps store them in the operating system’s secure storage. When debugging, check where your app keeps the token and whether it is being sent with each request.
Security rules for JWTs
- Never put secrets or sensitive personal data in the payload – it is readable.
- Servers must verify the signature and reject
"alg": "none". - Keep access tokens short-lived and use refresh tokens for longer sessions.
- Treat tokens like passwords: do not paste live production tokens into tickets, chats or untrusted websites.
ConvertNest decodes tokens entirely in your browser. Even so, prefer testing with tokens from development environments.
Related tools
Decode individual Base64URL parts with the Base64 Decoder, convert timestamps with the Timestamp Converter, and pretty-print other JSON with the JSON Formatter.