·6 min read·Blog

How to Read a JWT Token: Decoding the Header, Payload, and Signature

JWT tokens appear in every modern API — in Authorization headers, cookies, and URL parameters. Here's what the three parts contain, how to read them, and what the common claims mean.

What a JWT looks like

A JSON Web Token is three Base64URL-encoded strings separated by dots:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

The three parts are: header . payload . signature

Decode any JWT instantly with the free JWT decoder — paste the token and see the decoded header and payload in readable JSON format.

Part 1: The header

The header contains metadata about the token — specifically which algorithm was used to sign it. Decoding the first part of the example above:

{
  "alg": "HS256",
  "typ": "JWT"
}

Common alg values:

  • HS256 — HMAC-SHA256 (symmetric — same secret signs and verifies)
  • RS256 — RSA-SHA256 (asymmetric — private key signs, public key verifies)
  • ES256 — ECDSA-SHA256 (asymmetric, more compact than RSA)
  • none — No signature. Never accept this in production — it's a known attack vector where an attacker removes the signature and sets alg to "none" to forge tokens

Part 2: The payload (claims)

The payload contains the actual data — user ID, roles, expiration time, etc. Decoding the second part:

{
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
}

Standard registered claims (defined in RFC 7519):

ClaimNameMeaning
subSubjectWho the token is about (usually user ID)
issIssuerWho created the token (your auth server)
audAudienceWho the token is intended for (your API)
expExpirationUnix timestamp when the token expires
iatIssued AtUnix timestamp when the token was created
nbfNot BeforeToken is invalid before this Unix timestamp
jtiJWT IDUnique identifier for this token (prevents replay)

The exp claim is the most critical for security. If your server doesn't validate expiration, tokens that should be expired remain valid indefinitely. The JWT decoder shows the expiration as a human-readable date so you can quickly check whether a token has expired.

Part 3: The signature

The signature is created by combining the encoded header and payload, then signing them with the secret key:

HMACSHA256(
  base64url(header) + "." + base64url(payload),
  secret
)

The signature is what makes JWTs trustworthy. Anyone can read the header and payload — they're just Base64-encoded, not encrypted. But only the server that knows the secret key can create a valid signature. If an attacker modifies the payload (changing the user ID or role), the signature no longer matches, and any server that verifies the signature will reject the token.

Critical point: The payload is readable by anyone. Never put sensitive data in a JWT payload — no passwords, no credit card numbers, no SSNs. JWTs provide integrity (tamper detection) but not confidentiality (secrecy).

How to decode a JWT manually

In a browser console:

const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U";
const [header, payload] = token.split('.');
console.log(JSON.parse(atob(header)));    // Header object
console.log(JSON.parse(atob(payload)));   // Payload object

Note: atob() only handles standard Base64. Base64URL uses - instead of + and _ instead of /. For tokens with these characters in the payload, you need to replace them before decoding:

const base64 = base64url.replace(/-/g, '+').replace(/_/g, '/');
JSON.parse(atob(base64));

Where JWTs appear in API requests

  • Authorization header (most common): Authorization: Bearer eyJ...
  • Cookie: Cookie: token=eyJ... — common for browser-based apps (HTTP-only cookies prevent JavaScript access)
  • Query parameter (avoid): ?token=eyJ... — tokens in URLs appear in server logs and browser history

Related tools


Written by Achraf A., founder of TheFreeAITools.

Browse by category

Not sure which tool you need? Start with a category.

Everything you can do — for free

No software to buy. No account to create. Just open a tool and get it done.

Work with images

Compress photos before sending them by email, resize pictures for social media, remove backgrounds, or pick the perfect color for a design project — all without installing any app.

Edit and format text

Count words and characters in an essay, compare two documents side by side, convert text to different formats, or generate placeholder text for a presentation.

Stay safe online

Create a strong unique password in one click, check how secure a password is, encode or decode data, and generate secure tokens — your data never leaves your device.

Calculate anything

BMI, loan repayments, unit conversions, date differences, and dozens of other everyday calculations — no spreadsheet or formula knowledge required.

The Free AI Tools is a free collection of 221+ online tools that work directly in your web browser — no download, no installation, no account required. Whether you need to compress an image for email, count words in an essay, generate a strong password, create a QR code for your business, or format JSON for development — you will find a simple, free tool here.

Every tool is privacy-first: your files, text, and data never leave your device. Tools cover image editing, text processing, developer utilities, security & encoding, SEO & web, design & CSS, and more.

☕ Support Us