Developer Tools

Inside a JWT: three parts, two dots, and why decoding is not the same as trusting

A JSON Web Token looks like a random string with two dots. Split it at the dots and each part is readable. The catch: anyone can read it, and only the signature proves nobody changed it.

By the Toolcloak team8 October 20263 min read
In this article
  1. The three parts
  2. The claims you will see
  3. Decoding is not verifying
  4. Why “it is just encoded” matters
  5. Common JWT mistakes

Log in to many apps and the server hands you a token that looks like xxxxx.yyyyy.zzzzz. That is a JWT. It is the app's way of saying, without looking anything up, “this person was already checked.” Understanding what is inside makes login bugs much easier to fix.

The three parts

header.payload.signature
  1. 1HeaderSays which algorithm signed it, for example HS256 or RS256, and that the type is JWT
  2. 2PayloadThe claims: who the user is, who issued it, and when it expires
  3. 3SignatureA fingerprint made with a secret or private key. Change one character in the first two parts and it stops matching

The first two parts are Base64URL text. A browser or a decoder tool can read them in a blink.

The claims you will see

ClaimMeaningExample
subSubject: who the token is aboutA user ID
issIssuer: who created itYour auth server's address
audAudience: who it is meant forYour API
expExpiry time, as a Unix timestamp1790000000
iatIssued-at timeUnix timestamp
nbfNot valid before this timeUnix timestamp
jtiA unique ID for this tokenRandom string

Times are Unix seconds. See Unix time for how to read them.

Paste a token to see its header and payload, with the expiry turned into a readable date. Nothing leaves your browser.Open JWT Decoder

Decoding is not verifying

Two very different actions
DecodeTurn the first two parts back into JSON. Anyone can do it, no key needed. Fine for debugging.
VerifyRecompute the signature with the key and compare. This is what proves the token is genuine.
Trust the payload after decoding onlyDangerous. An attacker can write any payload they like.
Trust it after verifying and checking expCorrect. Verify the signature, then the time and audience.

Your server must verify every token on every request. A decoder tool is for reading, not for trusting.

Why “it is just encoded” matters

What a JWT is, and is not
IsSigned
  • Tamper-evident
  • Self-contained: the server needs no lookup
Is notSecret
  • Anyone holding it can read it
  • Not encrypted by default, so no passwords or private data inside

If you need the contents hidden, use an encrypted token (JWE) or keep the data on the server and send only an ID.

Common JWT mistakes

  1. Not checking `exp`. Without it, a stolen token works forever.
  2. Accepting `alg: none`. Always pin the allowed algorithms on the server.
  3. Long expiry for everything. Keep access tokens short, refresh them with a separate token.
  4. Storing tokens where scripts can read them. If a page can be injected, the token can be stolen.
  5. Pasting a live token into random websites. Use a tool that decodes locally, and treat real tokens like passwords.

Questions people ask

What is a JWT?

A JSON Web Token: a signed string made of a header, a payload of claims and a signature, joined by dots. Servers use it to prove a user was already authenticated.

Is a JWT encrypted?

Not by default. The header and payload are only Base64URL-encoded, so anyone can read them. The signature only prevents tampering.

What is the difference between decoding and verifying a JWT?

Decoding just reads the contents and needs no key. Verifying recomputes the signature with the key to prove the token is genuine and unaltered.

What does exp mean in a JWT?

The expiry time, as a Unix timestamp in seconds. After that moment the token must be rejected.

Is it safe to paste a JWT into an online decoder?

Only if the tool decodes in your browser and you are not sending a live production token to a service you do not trust. Treat real tokens like passwords.