What are the parts of a JWT?
195
09-Jun-2025
Updated on 09-Jun-2025
Anubhav Kumar
09-Jun-2025A JWT (JSON Web Token) has three parts, each separated by a dot (
.):1. Header
The header specifies the type of token and the signing algorithm used.
Example:
alg: Algorithm used for signing (e.g.,HS256,RS256)typ: Always"JWT"This part is Base64Url-encoded.
2. Payload
The payload contains the claims, which are statements about the user or system.
Example:
sub: Subject (usually user ID)iat: Issued at timestampexp: Expiration time (optional but recommended)3. Signature
The signature is used to verify the token’s integrity and authenticity.
It's created like this:
If someone modifies the token, the signature check will fail.
Example JWT
Here's a sample (fake) JWT for illustration: