The three parts

A JWT has three parts separated by dots: header.payload.signature. The header says which algorithm was used, the payload holds the claims, and the signature lets the server check that the token was not changed.

The header and payload are Base64URL-encoded JSON. That means anyone who has the token can read them. Encoding is not encryption, so never put secrets in a JWT payload.

Common claims

Claims are the facts stored in the payload. Some have standard names.

  • sub: the subject, usually a user ID
  • iss: the issuer that created the token
  • aud: the audience the token is meant for
  • exp: the expiry time, as a Unix timestamp
  • iat: when the token was issued
  • nbf: the time before which the token must not be accepted

Decoding is not verifying

Decoding only reads the contents. Verifying checks the signature with the right key and confirms that the token is valid. A decoder in your browser cannot verify a token without your secret or public key, and your own server must always verify tokens before trusting them.

Check expiry quickly

Many login bugs come from an expired token. The exp claim is a Unix timestamp, so converting it to a date shows when the token stopped working. The JWT Decoder shows the expiry status for you.

Handle real tokens with care

A live token can grant access to an account. Prefer test tokens when debugging, and avoid pasting production tokens into websites you do not trust. ToolWorkIt decodes tokens in your browser and does not send them anywhere.

Common questions

Frequently asked questions

Is a JWT encrypted?

A standard signed JWT is not encrypted. Its payload can be read by anyone who has it.

What does exp mean in a JWT?

It is the expiry time as a Unix timestamp in seconds.

Can a decoder tell me if a token is valid?

Only your server, with the correct key, can verify the signature.

Keep reading

More guides