What is a JWT decoder?
A JWT decoder takes a JSON Web Token, the long three-part string used in login sessions and API calls, and shows what is inside it. This one splits the token at its two dots, base64url-decodes the header and payload, prints both as indented JSON, and turns the time claims into readable dates. It does not verify the signature.
JSON Web Tokens are defined in RFC 7519. The signed form you normally see, header.payload.signature, is the JWS compact serialization from RFC 7515.
How to decode a JWT
- Copy the token. It usually starts with
eyJ, because that is how{"looks in base64url. - Paste it into the input box. A leading
Beareris fine. - Click Decode.
- Read the header, payload, dates and signature in the output panel.
Worked example
This is the sample token used in much JWT documentation:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
The decoder returns:
Header
{
"alg": "HS256",
"typ": "JWT"
}
Payload
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022
}
Dates (UTC)
Issued at (iat): 2018-01-18T01:30:22Z
Signature (not verified)
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
The header says the token was signed with HMAC-SHA256. The payload identifies user 1234567890, and iat (1516239022 seconds after 1 January 1970) becomes 18 January 2018, 01:30:22 UTC. There is no exp claim, so this token never expires by itself.
The claims you will see most often
RFC 7519 registers seven claim names. All are optional, and applications add their own next to them (name, email, roles, scope and so on).
| Claim | Meaning | Shown as a date |
|---|---|---|
iss |
Issuer: who created the token | No |
sub |
Subject: usually the user ID | No |
aud |
Audience: which service the token is meant for | No |
exp |
Expiration time, after which the token must be rejected | Yes, with expired / not expired yet |
nbf |
Not before: the token is invalid until this time | Yes, with "not valid yet" when in the future |
iat |
Issued at | Yes |
jti |
A unique ID for this token, used to prevent replay | No |
The three time claims are numbers of seconds since the Unix epoch. If a token stores one as a string, or in milliseconds, the JSON still shows the raw value; a string is left out of the Dates section and a millisecond value appears as a date far in the future.
In the header, alg names the signing algorithm (HS256, RS256, ES256, ...) and kid tells the server which key to use.
Error messages and what they mean
| Message | Cause |
|---|---|
| A JWT has three parts separated by dots | Part of the token was cut off when copying, or the text isn't a JWT |
| This token has five parts | It's an encrypted JWE, not a signed JWT |
| The header (or payload) is not valid base64url | A character outside A-Z a-z 0-9 - _ is present, such as = padding, + or /, or the segment was truncated |
| The header (or payload) decodes, but it is not valid JSON | The segment is Base64 of something else |
| The header (or payload) must be a JSON object | It decoded to a string, number or array |
JWTs use the URL-safe alphabet without = padding, so a string that was re-encoded with ordinary Base64 is rejected here.
Decoding is not verifying
Anyone can write a payload saying "admin": true, base64url-encode it and attach a made-up signature. This page will decode it happily, which is the reason a decoded token proves nothing about who issued it. A server must check the signature with the right key, pin the algorithm it expects, and then check exp, iss and aud. The IETF's JWT Best Current Practices (RFC 8725) lists the common mistakes, including accepting "alg": "none". If you paste an unsigned token, the output says so in place of the signature.
Related tools
- Base64 decoder: decode standard Base64 text.
- Unix epoch converter: convert
expandiatvalues to and from dates. - JSON formatter: tidy a payload you have copied elsewhere.
- HMAC generator: compute the HMAC-SHA256 that HS256 signatures are built on.
Last updated