Ultimate Guide · 2026
JWT Security Guide: What a Token Inspector Reveals About Your Auth System
JSON Web Tokens power authentication for millions of APIs — yet most security incidents involving them are not exotic zero-days. They are the same handful of configuration mistakes: no expiration check, weak algorithms, secrets in the payload. This guide shows you exactly how to read a token, and exactly what to harden.
Written by Benjamin Rotshtein
Updated
The three parts of a JWT
A JWT is three dot-separated segments. Each segment is Base64Url-encoded, and only the third one is cryptographically meaningful:
header.payload.signature
Header — declares the signing algorithm (e.g. HS256) and token type. Payload — the claims: who the user is, when it was issued, when it expires. Signature — proves the first two segments were not modified by anyone without the key.
Here is a real example token, with the three segments colored to match the anatomy:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkFkYSBMb3ZlbGFjZSIsImlhdCI6MTUxNjIzOTAyMiwiZXhwIjoxNzk5OTk5OTk5fQ. SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Paste this sample into the JWT decoder and watch each segment be decoded in real time.
Standard claims: what a decoded payload tells you
When you decode the payload, the security-relevant fields are the registered claims:
| Claim | Name | Meaning |
|---|---|---|
| sub | Subject | The user or entity the token belongs to |
| iat | Issued At | Unix timestamp when the token was created |
| exp | Expiration | Unix timestamp after which the token is invalid |
| iss | Issuer | Who created the token, e.g. your auth server |
| aud | Audience | Who the token is intended for (your API) |
| jti | JWT ID | Unique identifier, useful for revocation |
Any other field is a private claim — application-specific data. The rule is simple: treat everything in the payload as readable by the bearer, and verify the signature before trusting any of it.
How the signature works: HS256 vs RS256
The signature is what makes a JWT trustworthy. It is computed over the encoded header and payload using a signing algorithm:
- HS256 (symmetric) — the same secret signs and verifies. Simple and fast, but every service that verifies tokens must hold the secret, and anyone with it can forge tokens.
- RS256 (asymmetric) — a private key signs; a public key verifies. Your auth server keeps the private key, and downstream services verify with the public key only. This is the recommended choice for microservices and multi-service systems.
What a token inspector reveals about your auth system
Pasted into a decoder, a single production token exposes more than you might expect about your architecture:
- The alg field leaks your signing setup. If you see
"alg":"none", verification can be bypassed. HS256 tells attackers a shared secret exists; RS256 means a public key is available. - The exp claim reveals your session policy. No exp, or exp years in the future, means long-lived tokens with a huge theft window. Compare exp with iat: if a token was issued in 2016 and never expires, your validation code is missing a check.
- The payload reveals data hygiene. Tokens containing passwords, email addresses, roles or billing data are readable by anyone holding the token — a privacy leak waiting for a log dump or an XSS to expose it.
- The signature length hints at key strength. A short signature over an HS256 token often points to a weak, guessable secret (like "secret" or "password").
The JWT hardening checklist
- Always verify the signature. Reject any token whose signature does not validate with your key. Never trust the header's alg field blindly — whitelist exactly HS256 or RS256.
- Check exp on every request. Reject expired tokens. Require a short exp (minutes to hours), and use refresh-token rotation for long-lived sessions.
- Use RS256 when multiple services verify. Distribute only the public key; keep the private key on the issuing server.
- Keep secrets out of the payload. Store only non-sensitive identifiers. Sensitive data lives in your user-store, referenced by the sub claim.
- Serve over HTTPS only. A JWT is just a string — anyone who intercepts it can replay it. Transport security is not optional.
- Use strong secrets. For HS256, use a randomly generated secret of at least 256 bits. Weak secrets are crackable offline within minutes.
- Never paste production tokens into server-side tools. Decode locally, in your browser, so the token never leaves your machine.
Frequently asked questions
Is it safe to decode a JWT?
Yes — decoding the header and payload only Base64-decodes the first two segments, which are not encrypted and are readable by anyone. Never paste real tokens from production into a server-side tool; use a client-side decoder like this one so the token never leaves your browser.
Can anyone read the data inside a JWT?
Yes. The header and payload are only Base64-encoded, not encrypted — anyone can read them. The signature protects integrity (proving the token was not modified), not confidentiality. Never put passwords or other secrets in the payload.
What is the difference between HS256 and RS256?
HS256 signs with a single shared secret (symmetric); anyone with the secret can both verify and forge tokens. RS256 uses a public/private key pair (asymmetric); your server verifies with the public key and only the private key can sign. RS256 is recommended for anything shared across services.
How do I know if a JWT is expired?
Check the exp claim: a Unix timestamp. Compare it with the current time — if exp is in the past, the token must be rejected. A token with no exp claim never expires, which is almost always a security flaw.
Why should I not store sensitive data in the JWT payload?
Because the payload is readable by anyone who sees the token. Attackers who intercept a token — or find one in logs — can read every field. Store only non-sensitive identifiers and claims; keep secrets server-side.
Decode your own tokens — 100% in your browser
Use the Token Inspector to decode JWTs, inspect Base64 and URLs, and generate hashes. Everything runs locally — nothing you paste is ever sent to a server.