A JSON Web Token looks like one long smear of random characters. It is not random, though. It has a strict internal structure: three segments, joined by dots, each with a distinct job. Once you know what each segment holds, a token stops being opaque. You can read two of the three parts yourself, and you know exactly which part you cannot judge, and why.
This guide walks through the structure part by part, using the classic demo token as the specimen. The free JWT Decoder on Ovatly does the reading: it shows the header and payload in plain JSON and translates the expiry into a readable date.
Contents
- Quick answer
- Three segments, one job each
- Segment one: the header
- Segment two: the payload
- Segment three: the signature
- How to inspect a token's structure, step by step
- Worked example: the classic demo token, part by part
- Limitations: structure is not proof
- Common mistakes
- FAQs
- Conclusion
Quick answer
A JWT is three segments joined by dots. The first is the header, a small JSON object naming the algorithm and the token type. The second is the payload, a JSON object of claims: subject, issuer, issued-at and expiry, among others. The third is the signature, produced by the issuer. The header and payload are encoded, not encrypted, so pasting a token into the JWT Decoder shows both in plain JSON, with an expired or not-expired verdict. The signature segment is shown as present but not verified, because checking it needs the signing key or the issuer's public key, which a decoder page does not have.
Three segments, one job each
The three parts answer three different questions. The header answers: how was this token signed, and what kind of token is it? The payload answers: what does this token claim? The signature answers: can those claims be trusted? A decoder can fully answer the first two and cannot answer the third at all.
The dots are structural, not decoration. A token with the wrong number of segments is not in JWT shape at all, which is why decoding starts with the full token, all three dot-separated parts.
Segment one: the header
The header is the smallest part: a JSON object with two fields you will see in almost every token. The first, alg, names the signing algorithm. The second, typ, names the token type. In the classic demo token the decoded header reads {"alg":"HS256","typ":"JWT"}.
The header's job is descriptive. It tells any system handling the token how the signature was produced, so the system knows what verification would involve. It carries no user data and no times. Read it first when you decode a token: it frames everything after it.
Segment two: the payload
The payload is where the token's content lives: a small JSON object of claims. The registered claim names are short. Sub is the subject, usually the user id. Iss is the issuer. Aud is the intended audience. Exp is the expiry. Iat is the issued-at time. Tokens can also carry custom claims, such as a name.
This is the part developers actually debug with, for questions like: which user does this token claim to be, which issuer issued it, and has it already expired? Two of the claims, exp and iat, are times expressed as seconds since the Unix epoch, which no human reads at a glance. The decoder translates the expiry into a readable date and states plainly whether the token is expired or not expired.
One property deserves emphasis: the payload is readable by anyone holding the token. Encoding is a formatting step, not a lock, and that readability is why the payload alone can never be treated as proof of anything.
Segment three: the signature
The signature is the segment the issuer produced with a secret or a private key, and it is the only part of the token that protects the other two. Its job is verification: when a server receives the token, it checks the signature using the signing key or the issuer's public key. If the header or payload had been altered after signing, that check is where the alteration gets caught.
Verification needs the secret or public key used to sign the token, and a decoder page does not have it. So the JWT Decoder shows that the signature segment is present and labels it, plainly, as not verified. Its presence tells you the token was built in the right shape; only the issuer's check tells you whether it is genuine.
How to inspect a token's structure, step by step
- Paste the full token, all three dot-separated parts, into the JWT Decoder.
- Read the decoded header, which names the algorithm and token type.
- Read the payload claims: subject, issuer, issued-at and expiry.
- Check the expiry panel for the verdict, and remember the signature warning.
Read in that order, the structure explains itself: method, claims, verdict, and a reminder of which question is still open.
Worked example: the classic demo token, part by part
Take the well-known demo token. Its first segment decodes to the header {"alg":"HS256","typ":"JWT"}. Nothing hidden there: algorithm HS256, type JWT.
The second segment decodes to a payload containing sub "1234567890", name "John Doe" and iat 1516239022. Read as claims: the token is about subject 1234567890, it carries a name claim of John Doe, and its issued-at time is the epoch value 1516239022. This token carries no exp claim, so it is reported as having no expiry of its own, which is common for some API tokens.
Now add an exp claim of 4000000000 to that payload. The expiry panel reports expiry on 2 October 2096, so the token is not expired. One claim changed, and the verdict changed with it, because the panel is computed from the exp claim and nothing else.
The third segment, the signature, is present throughout, and in every version the page states it is not verified. The structure is complete and readable; the proof question stays where it belongs, with the issuer's key.
Limitations: structure is not proof
A perfectly formed token, with a tidy header, plausible claims and a signature segment of the right shape, can still be a forgery that someone built with a key they invented. It would decode beautifully. Decoding is not verification, and a decoded payload is a claim, not a proof.
The expiry verdict has a softer edge. The tool reports the exp claim exactly, but your server's policy decides what is enforced. Some systems allow clock skew leeway of a minute or two, and some ignore exp for specific flows, so a token can read as expired in the decoder while an app still accepts it.
Finally, the safety model: everything happens locally, because tokens are credentials and this page never uploads the one you paste. Treat tokens like passwords generally, and keep them out of public places and screenshots.
Common mistakes
- Assuming the payload is secret. It is encoded, not encrypted. Anyone with the token can read the claims, as the decoder demonstrates.
- Treating a readable payload as proof. Neat JSON is still a claim. Only the issuer's signature check turns it into proof.
- Ignoring the signature warning. The segment being present is not the segment being verified. The tool labels it not verified for a reason.
- Pasting a truncated token. A JWT is three dot-separated parts; a fragment copied from a log line will not decode into anything useful.
- Reading epoch times by eye. Exp and iat are seconds since the Unix epoch. Let the panel translate them.
FAQs
What are the three parts of a JWT? A header, a payload and a signature, joined by dots. The header names the algorithm and token type, the payload carries claims such as sub, iss, iat and exp, and the signature is the part the issuer produced to protect the other two.
Is the payload of a JWT encrypted? No. The header and payload are encoded, not encrypted, which is why a decoder can show them in plain JSON. Anyone holding a token can read its payload, so the claims inside are readable by design.
What does the signature do if the decoder does not check it? The signature is what the issuer's server checks during verification, using the signing key or the issuer's public key. It is the proof mechanism of the token. A decoder only shows that the segment is present and labels it not verified.
What do alg and typ in the header mean? They are the two header fields the decoder shows: alg names the signing algorithm, HS256 in the classic demo token, and typ names the token type, JWT.
Why does the demo token show an expiry in the year 2096? Because of its exp claim. With exp set to 4000000000, which is seconds since the Unix epoch, the tool converts it to a readable date and reports expiry on 2 October 2096, so the token is not expired.
Conclusion
Header, payload, signature: method, claims, proof. The first two you can read yourself in seconds with the JWT Decoder, including an expiry verdict computed from the exp claim. The third you can only respect from a distance, because verification belongs to whoever holds the issuer's key. When a readable token still gets rejected, the companion guide walks through the likely causes: Why Is My JWT Invalid?
More tools for this kind of work live in the Developer Tools archive.