JWT Fields Explained: Understanding JSON Web Token Attributes and Composition
Learn what every JWT field and attribute means: header fields (alg, typ, kid), standard payload claims (sub, iss, aud, exp, iat, nbf, jti), custom attributes, and token composition.
What Are JWT Fields and Attributes?
A JSON Web Token (JWT) looks like a long string of random letters and numbers. But inside, it is just simple JSON holding user information and rules.
In this guide, we break down what every field inside a JWT means, how the token is put together (its composition), and how to read standard attributes like sub, exp, and iss without any confusion.
1eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfOTg3IiwibmFtZSI6IlNoeWFtIEJoYXRpIiwicm9sZSI6ImFkbWluIiwiZXhwIjoxNzkzMzUwODAwfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk1. What Is the Composition of a JWT?
Every JWT is composed of three distinct parts separated by dots (.):
Tells your server what kind of token this is and which algorithm was used to sign it.
The heart of the token. Contains all the user data, attributes, permissions, and expiration times.
A cryptographic seal created with a secret key. Ensures nobody changed the payload along the way.
In short, a JWT formula is always: Header.Payload.Signature.
2. Why Is It Called a JSON JWT?
Many developers ask: "If it is called a JSON Web Token, why does it look like gibberish instead of JSON?"
The answer is simple: Both the Header and the Payload start out as plain, standard JSON objects. But because URLs and HTTP headers do not like spaces, curly braces, and quotes, those JSON objects are converted into clean text using Base64URL encoding.
When you decode the middle section of a token, you get regular JSON back. You can inspect this right now using our free JWT Decoder tool.
3. JWT Header Fields Explained
The header is the first JSON object in a JWT. Here is what it usually looks like:
1{2 "alg": "HS256",3 "typ": "JWT",4 "kid": "key-prod-2026"5}| Field | Full Name | What It Does |
|---|---|---|
| alg | Algorithm | Tells the system which cryptographic algorithm was used to sign the token (e.g. HS256, RS256, ES256). |
| typ | Type | Specifies the media type of the token. In almost every case, this is set to "JWT". |
| kid | Key ID | A friendly identifier telling your backend server which key was used to sign the token when you rotate keys. |
4. Standard JWT Payload Fields (Registered Claims)
The official JWT standard (RFC 7519) reserves seven standard field names. They are all three letters long to save space. Here is a complete token payload using them:
1{2 "sub": "usr_987",3 "iss": "https://auth.playwithjson.com",4 "aud": "https://api.playwithjson.com",5 "exp": 1793350800,6 "nbf": 1793347200,7 "iat": 1793347200,8 "jti": "c4b901a8-9d22-4a0b"9}| Field | Full Name | What It Means In Plain English |
|---|---|---|
| sub | Subject | Identifies who or what the token is about. Usually this is the unique User ID or Account ID in your database. |
| iss | Issuer | Identifies the server or service that created and sent the token (e.g. your auth domain). |
| aud | Audience | Identifies the intended recipient of the token. Your API checks this to make sure the token was meant for it. |
| exp | Expiration Time | The exact time when the token stops being valid. Stored as Unix timestamp in seconds. |
| iat | Issued At | The exact Unix timestamp in seconds when the token was created. |
| nbf | Not Before | The time before which the token must not be accepted. Useful for scheduled or delayed access. |
| jti | JWT ID | A unique identifier for this individual token. Useful to prevent replay attacks or to blacklist tokens. |
5. Custom JWT Attributes and Public Claims
You are not limited to the standard fields. You can add your own custom attributes to the payload so your frontend or backend knows who the user is without having to query the database on every single click:
1{2 "sub": "usr_987",3 "name": "Alex Morgan",4 "email": "alex@example.com",5 "role": "editor",6 "plan": "premium",7 "iat": 1793347200,8 "exp": 17933508009}name: The user's display name (e.g. "Alex Morgan").role: Their authorization role (e.g. "admin", "editor", "user").plan: Their subscription tier (e.g. "free" or "pro").isVerified: A boolean flag for verified email accounts.
6. How Dates Work in JWT Fields (exp and iat)
Notice how the exp (expiration) and iat (issued at) fields look like big numbers: 1793350800.
In JWTs, dates are stored as Unix timestamps in seconds. This represents the total number of seconds that have passed since January 1, 1970.
Here is a very simple code snippet showing how to check if a JWT is expired in JavaScript:
1// Checking JWT expiration in simple JavaScript2const payload = {3 sub: "usr_987",4 exp: 1793350800 // Unix timestamp in seconds5};67// Current time in seconds (divide Date.now() by 1000)8const nowInSeconds = Math.floor(Date.now() / 1000);910if (payload.exp < nowInSeconds) {11 console.log("Token has expired! Please log in again.");12} else {13 console.log("Token is still valid!");14}Date.now() returns milliseconds. But JWT fields use seconds. Remember to divide by 1000 or multiply by 1000 when comparing them.7. Common Mistakes with JWT Fields and Attributes
JWT payloads are not encrypted. Anyone who intercepts the token can decode it and read every field in plain text. Only store non-sensitive identifying data.
Because the token travels with every API request inside the HTTP Authorization header, putting thousands of user attributes in it will slow down your app and may exceed web server header size limits (usually 8 KB).
Just reading the fields is not enough. Your backend must always verify the signature using your secret key before trusting the claims inside.
Inspect Your JWT Fields Online
Want to see the exact Header and Payload fields of your own token? You can paste any JWT into our free, client-side JWT Decoder Tool. It decodes tokens instantly in your browser without sending any credentials to our servers.