JWT decoder

Paste a JSON Web Token to see its header and payload, what every claim means, and whether it has expired. Damaged tokens are marked where they break, with a fix.

Valid
Encoded token
Check the signature

Paste the secret to check the token hasn’t been tampered with. The sample’s secret is hinkel.

Decoded
Ready

How a JWT is built

A JWT is three Base64url-encoded parts joined by dots:

header.payload.signature
  • Header: which algorithm signed it (alg) and the token type (typ).
  • Payload: the claims, which are facts about the user and the token, such as sub, exp and roles.
  • Signature: HMACSHA256(base64url(header) + "." + base64url(payload), secret) for HS256. Change one character of the payload and the signature no longer matches.

Registered claims cheat sheet

ClaimNameWhat it’s for
issIssuerWho created the token
subSubjectWho it’s about, usually a user ID
audAudienceWhich service should accept it
expExpirationReject after this Unix time
nbfNot beforeReject before this Unix time
iatIssued atWhen it was created
jtiJWT IDUnique ID, useful for revocation

Debugging a token that won’t work

Tokens get damaged on their way through logs, emails and config files. The decoder marks the damage on the token itself and shows everything it can still read:

  • Line breaks and spaces from a wrapped log line are marked and removed in one click.
  • Standard Base64 (+ / =) instead of URL-safe is converted.
  • Missing or extra dots are pointed out, including a cut-off signature.
  • A broken header or payload is laid out with the exact JSON error marked, just like the JSON formatter.
  • Time claims: expired tokens, nbf in the future, an iat in the future (a server clock running fast) and exp in milliseconds are all called out.
  • Secret mix-ups: if the signature only matches with the secret read as Base64 (or as plain text), the verifier says so.

Decoding a JWT in code

Decoding (no verification) is just Base64url and JSON:

const [, payload] = token.split('.');
const claims = JSON.parse(atob(payload.replace(/-/g, '+').replace(/_/g, '/')));

To verify, use a proper library rather than rolling your own: jose (JavaScript), PyJWT (Python), golang-jwt (Go). Always pin the expected algorithm and check exp, aud and iss.

Debugging a 401?Check three things first: has exp passed, does aud match your API, and is the server clock in sync? Clock skew of a minute or two is a classic cause.

Questions people ask

Is it safe to paste a real token here?
Decoding happens entirely in your browser, and nothing is sent anywhere. Still, treat live production tokens like passwords: prefer expired or test tokens when you can.
Is a JWT encrypted?
Usually not. A normal JWT (a JWS) is only signed. Anyone can read the header and payload, and the signature just proves it wasn’t changed. Never put secrets in a JWT payload. Encrypted JWTs (JWE) have five parts instead of three.
Why can’t I verify RS256 or ES256 tokens?
Those are signed with a private key and checked with a public key, usually published at the issuer’s /.well-known/jwks.json. This tool verifies shared-secret HMAC tokens (HS256, HS384, HS512).
What does “exp” mean?
The expiry time, in seconds since 1 January 1970 (Unix time). Servers should reject the token after that moment. The decoder shows it as a readable date and tells you how long is left.
Why does my server reject this token?
Check the claims first: an exp in the past, an nbf in the future, or an exp written in milliseconds instead of seconds. All three are flagged in the claims table. If the claims look fine, check the signature. A common mix-up is a secret stored as Base64 but used as plain text, and the verifier tells you when that’s the case.
What is alg: none?
An unsigned token. It shouldn’t be accepted by any production system, and a server that accepts it is vulnerable to forged tokens.
↑↓ move↵ openesc close