Decode a JWT
A JWT is three base64url segments separated by dots: header, payload and signature. Decoding reads the first two and proves nothing about authenticity — only the issuer's key can verify the signature.
A JSON Web Token looks like three random strings joined by dots:
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjMifQ.dBjftJeZ4CVPmB92K27uhbUJU1p1r_wW1gFWFOEjXk
It is not encrypted. It is encoded. That distinction is the source of most JWT mistakes.
The three parts
- Header — which algorithm signed the token, usually
HS256orRS256, and the token type. - Payload — the claims: who the token is about (
sub), who issued it (iss), who it is for (aud), when it expires (exp) and when it was issued (iat). Anything else the issuer chose to put in. - Signature — the header and payload, signed with a key. This is the only part that provides any security.
The first two segments are base64url, a URL-safe variant of base64 with + and / replaced and padding dropped. Decoding them is a text transformation, not a cryptographic operation.
What decoding does not tell you
It does not tell you the token is genuine. Anyone can write a payload claiming to be an administrator and encode it. The signature is what a server checks; without the key, nobody can forge it.
This is why "the JWT says role: admin" is not authorisation. A server that reads the payload without verifying the signature is trusting whatever the client sent — a well-known class of bug.
Decoding safely
- Use a local decoder. Pasting a production token into a website hands that site a working credential. Tokens are bearer credentials: whoever holds one can act as the user until it expires.
- Check the timestamps.
exp,iatandnbfare Unix seconds, not milliseconds. A token that "expired in 1970" is usually a millisecond timestamp divided by the wrong figure. - Read the algorithm. If a token claims
alg: none, something is wrong upstream. Rejecting that is table stakes for a verifier.
Reading the claims that matter
| Claim | Meaning | Common mistake |
|---|---|---|
exp | Expiry, in seconds | Comparing to a local time instead of UTC |
aud | Intended audience | Not checking it, so a token for service A is accepted by service B |
iss | Issuer | Not checking it, so any issuer's token is accepted |
sub | Subject, usually a user id | Treating it as a role or permission |
The one-line rule
Decode to understand a token. Verify to trust it. The two are different operations, and only the second one uses a key.
Questions
Is a JWT encrypted?
No. JWS tokens are signed and readable by anyone. Only JWE tokens are encrypted, and they are far less common. Treat any JWT payload as public data.
Can someone change the payload and still pass verification?
Not without the signing key. Changing one character of the payload invalidates the signature, which is the entire point of signing.
Why is my token three dots but four parts?
Some tokens include a trailing dot or use a five-part JWE structure. Standard JWS tokens have exactly three parts.
Is it safe to paste a token into this tool?
The decoding happens in the browser, so nothing is transmitted. Even so, treat real tokens as passwords: a screenshot of one is a credential leak.
Updated 2026-11-16 · written for this site, no trackers, no account.