JWT decoder
Paste a token to read what it says and check it.
The token
Header
Payload
Claims, explained
Check the signature
How a JWT is built
A JSON Web Token is three pieces of Base64url separated by dots: a header, a payload with the claims, and a signature. The first two are JSON that anyone can decode. This is the classic example token from jwt.io, and what its parts say:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
header: {"alg":"HS256","typ":"JWT"}
payload: {"sub":"1234567890","name":"John Doe","iat":1516239022}The header says the token is signed with HS256. The payload says who it is about (sub), a name, and when it was issued: iat is 1516239022 seconds after 1 January 1970, which is 18 January 2018 at 01:30:22 UTC. The third part is 32 bytes of HMAC-SHA-256, made with the secret your-256-bit-secret; paste the token above and type that secret to see it verified.
The registered claims
RFC 7519 defines seven claim names that mean the same thing in every token. All of them are optional; the issuer decides which to include.
| Claim | Name | What it says |
|---|---|---|
iss | Issuer | Who created the token, often the sign-in server’s address. |
sub | Subject | Who it is about, usually a user id that never changes. |
aud | Audience | Which services should accept it; others must reject it. |
exp | Expiration time | The moment it stops being valid. |
nbf | Not before | The moment it starts being valid. |
iat | Issued at | When it was created. |
jti | JWT ID | A unique id, so a server can refuse the same token twice. |
exp, nbf and iat are counted in seconds since 1970-01-01 00:00 UTC, the Unix time. This page shows each one in your time zone, in UTC and as “in 2 hours” or “3 days ago”; to convert other timestamps, use the Unix timestamp converter.
Signed is not encrypted
The signature proves who made the token and that nobody changed it, but it hides nothing. Anyone who holds a JWT can read its payload: it is only Base64url, which the Base64 decoder also reads. Never put passwords, card numbers or anything secret in a token’s claims.
Tokens whose contents must stay private use a different format, JWE, which has five parts instead of three. This page recognises them but cannot read them without the key.
How the signature is checked
The signature is computed over the first two parts exactly as written, header, a dot and payload, so changing a single character of either makes it invalid. What you need to check it depends on the algorithm in the header:
| alg | Method | What you need |
|---|---|---|
HS256, HS384, HS512 | HMAC with SHA-2 | The same secret the issuer used |
RS256, RS384, RS512 | RSA (PKCS#1 v1.5) | The issuer’s RSA public key |
PS256, PS384, PS512 | RSA-PSS | The issuer’s RSA public key |
ES256, ES384, ES512 | ECDSA (P-256, P-384, P-521) | The issuer’s EC public key |
EdDSA | Ed25519 | The issuer’s Ed25519 public key |
Public keys are published by the issuer, usually as a JWK Set at an address like https://issuer/.well-known/jwks.json; an OpenID Connect provider lists that address as jwks_uri in /.well-known/openid-configuration. The kid in the token’s header says which key of the set signed it. You can paste the whole set here: the key with the matching kid is used. A PEM public key, a PEM certificate and a single JWK work too.
Common problems
- Expired a moment too soon or too late: the clocks of the issuer and the server differ. Servers usually allow a minute or two of leeway.
- A date tens of thousands of years from now: exp was written in milliseconds (Date.now() in JavaScript) instead of seconds. This page warns when it sees one.
- Invalid signature with the right secret: the secret is stored in Base64 and must be decoded first, or the other way around. Try the “Base64-encoded” box.
- Invalid signature with the right key: the issuer rotated its keys, and the kid in the header points to a newer one than the key you have.
- Invalid signature after copying: a character was cut off or changed. Quotes, line breaks and “Bearer ” are removed here, but a missing character is not.
- alg “none” or a switched algorithm: a server must decide which algorithm it accepts and never take it from the token, or an attacker can send an unsigned token, or sign one with HS256 using the server’s public RSA key as the secret.
Where tokens come from
Most JWTs travel in an HTTP header, Authorization: Bearer followed by the token, or in a cookie. With OpenID Connect, signing in returns an ID token, which is always a JWT and describes the user to the app. OAuth 2.0 access tokens, which an app sends to an API, are often JWTs too, but some providers make them opaque strings that cannot be decoded; that is not an error.
Questions
Is it safe to paste my token here?
This page decodes and verifies the token in your browser and sends it nowhere, which you can check by using it offline. Still, a live token works like a password until it expires: whoever has it can act as you. Pasting it into a site that sends it to a server hands it over, so prefer test or expired tokens on any site you do not trust.
Can I change a claim and keep the token valid?
No. Changing any character of the header or payload breaks the signature, and making a new valid one needs the secret or the private key. That is exactly what the signature is for.
Why does the token say “No expiry date”?
It has no exp claim. That is allowed, but such a token stays valid until the server stops accepting it some other way, for example by changing its key, so most issuers include exp.
What is the difference between an ID token and an access token?
An ID token tells the app who signed in, and is meant to be read by the app; its aud is the app’s client id. An access token is a key to call an API; its aud is the API, and the app should not depend on what it contains.
More developer tools
-
JSON formatter and validator
Format, minify and validate JSON, with clear errors and big numbers kept exactly.
-
Hash generator
MD5, SHA-1 and SHA-256 of text or files, and check a download’s checksum.
-
Unix timestamp converter
Turn Unix timestamps into dates and dates into timestamps, in your time zone and UTC.