What are the three parts of a JWT?
A typical signed compact JWT looks like xxxxx.yyyyy.zzzzz. Periods separate a protected header, a claims payload and a signature. The first two segments are Base64url-encoded JSON. The final segment carries a cryptographic value computed over the protected header and payload for the relevant signing algorithm.
| Part | Usually contains | What the inspector can tell you |
|---|---|---|
| Header | Algorithm identifier and token type; sometimes key ID. | Which header values are present, not whether they should be trusted. |
| Payload | Claims about a subject, issuer, audience or application-specific data. | Readable JSON and common timestamp interpretations. |
| Signature | MAC or digital signature bytes encoded for compact transport. | The existence and length of the encoded segment—not its validity. |
Decode vs. verify: why the difference matters
Base64url encoding is not encryption. Anyone who obtains an ordinary signed JWS token can usually decode its header and payload. A signature is intended to let a verifier check integrity and authenticity, but a formatter that does not have the correct verification key and policy cannot do that check.
For production validation, use a maintained JWT library. Configure accepted algorithms in your application, verify the signature using a trusted key, and validate the expected issuer, audience, time claims and authorization rules. Never let the token's untrusted alg header decide the application's allowed verification algorithms.
What the time claims mean
exp is the expiry time, nbf is the not-before time, and iat is the issued-at time. These common JWT time values use NumericDate, typically seconds from 1 January 1970 UTC. Applications may apply a small clock-skew allowance, and the exact validation policy is application-specific.
Common decode errors
- Wrong number of segments: a standard compact JWS JWT has three parts. An encrypted compact JWE often has five.
- Invalid Base64url: check for missing characters, pasted quote marks inside the token, or characters altered during copying.
- Invalid JSON: a segment may decode to bytes but not to a JSON object. The token may be truncated, malformed or a different format.
- Expired timestamp: the local clock comparison is a clue, not proof of the application's full validation result.
For field-by-field meanings, continue to the JWT claims reference. If you want the anatomy and encoding explained first, read JWT token parts.