How to decode and check a JWT
- Paste the token into Your JWT. A whole
Authorization: Bearer …header, quotes and line breaks are fine: they are removed. Press Try an example to see a fresh token signed a moment ago. - The token is decoded as you type. The coloured view shows its three parts, the header and payload appear as formatted JSON, and Claims explained lists every claim with its meaning. Dates such as
expandiatare shown in your own time zone, with how long ago or how soon they are. - What a server would say lists the problems a careful server would find: an expired token, one that is not valid yet, a missing expiry,
algset to none, or times written in milliseconds. - To check the signature, paste the shared secret (for HS256, HS384 and HS512) or the issuer’s public key under Check the signature. The result says whether the signature is valid, and why not when it fails.
To make a token, switch to Create and sign, choose an algorithm, edit the claims, paste a secret or private key or press Generate for a new one, and press Sign. Decode it opens the new token in the decoder with its key, so you can see the round trip work.
What is in a JWT
A JSON Web Token (RFC 7519) is three pieces of base64url text joined by dots: header.payload.signature. The header is a small JSON object that names the signing algorithm (alg) and often the key that signed it (kid). The payload is a JSON object of claims: facts about the user and the token, such as who issued it and when it expires. The signature is computed over the first two parts with the issuer’s secret or private key.
Base64url is a way of writing bytes with letters, digits, - and _, so a token can travel in a web address or a header. It is not encryption: anybody who has a token can read its payload, exactly the way this page does. What the signature adds is integrity: change one character of the header or payload and the signature no longer matches.
The registered claims
| Claim | Name | What it is for |
|---|---|---|
iss | Issuer | Who created and signed the token, often the sign-in server’s address. |
sub | Subject | The user or thing the token is about, usually a user ID. |
aud | Audience | The app or API the token is for; a receiver rejects a token addressed to someone else. |
exp | Expiration time | The moment the token stops being valid. |
nbf | Not before | The moment the token starts being valid. |
iat | Issued at | When the token was made. |
jti | JWT ID | A unique ID, so a server can refuse the same token twice. |
Times are NumericDate values: whole seconds since 1 January 1970 UTC, the same count Unix systems use. A value thirteen digits long is a sign that someone wrote milliseconds by mistake, which pushes the date tens of thousands of years into the future. You can convert any such number by hand with the Unix timestamp converter. OpenID Connect ID tokens add profile claims such as name, email and nonce, and OAuth access tokens often carry scope, client_id and roles; the tool explains those too.
Algorithms and the keys they need
| alg | Method | Key to check it |
|---|---|---|
| HS256, HS384, HS512 | HMAC with SHA-2 | The same shared secret that signed it |
| 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 on P-256, P-384, P-521 | The issuer’s elliptic-curve public key |
| EdDSA, Ed25519 | Ed25519 | The issuer’s Ed25519 public key |
With HMAC, the same secret signs and checks, so every service that checks tokens could also make them. With the public-key algorithms only the issuer holds the private key, and anyone can check tokens with the public key. Big sign-in services publish their public keys as a JWKS (JSON Web Key Set), usually at an address listed under jwks_uri in their /.well-known/openid-configuration document. Paste the whole set here and the key whose kid matches the token is used.
Verifying tokens safely in your own code
- Use a maintained library and tell it exactly which algorithms you accept. Never let the token’s own
algdecide, and never acceptnone. - Check
expandnbfwith a small allowance for clock differences; RFC 7519 suggests no more than a few minutes. - Check that
issis the issuer you expect and thataudincludes your app or API. - Do not trust a key that arrives inside the token (a
jwkorjkuheader) unless it matches a key you already trust. - Give tokens short lifetimes, since a signed token cannot be taken back before it expires unless the server keeps a list of revoked IDs.
These rules come from the JWT best current practice, RFC 8725, which collects the mistakes behind real attacks on JWT libraries.
Common problems
- The payload looks like nonsense. The token may be cut short, or it may be an encrypted JWE (five parts instead of three); the decoder says which.
- The signature fails with the right secret. Many services store the secret base64-encoded. Switch Secret is written as to Base64 or Base64url and try again.
- It worked yesterday. The issuer may have rotated its signing keys: fetch its key set again and look for the token’s
kid. - An ES256 token fails in one library only. JWS wants the two halves of an ECDSA signature joined as raw bytes (64 bytes for ES256). Some code writes them in the longer DER format, and the decoder points that out.
Other building blocks of tokens have their own tools here: the Base64 encoder and decoder for single parts, the JSON formatter for big payloads, and the hash generator for SHA-256 and other digests.
Privacy
The page is a set of static files. Once it has loaded, decoding, checking, signing and key generation all happen in your browser with its built-in Web Crypto, and nothing you paste is sent anywhere or kept after you close the tab. Only your choices, such as the algorithm, are remembered on this device. The example token is made on your device too, signed with a made-up secret that is shown in the key box.
Frequently asked questions
Is my token uploaded anywhere?
No. Decoding, the signature check, signing and key generation all run in your browser with its built-in Web Crypto, and the page sends nothing anywhere. Tokens, secrets and keys are not saved either: close the tab and they are gone. Even so, treat a live token like a password: it can be used until it expires.
Is decoding a JWT the same as verifying it?
No. Anyone can decode a JWT, because the header and payload are only base64url-encoded, not encrypted. Verifying recomputes the signature with the secret or the issuer’s public key and proves the token was made by the issuer and not changed since. A server must also check the time claims, the issuer and the audience before it trusts a token.
Why does it say “Invalid signature”?
Usually one of these: the wrong secret or key; a secret that is stored base64-encoded but entered as plain text (or the other way round); a key set where the token’s kid points at a newer key after the issuer rotated its keys; a token that was edited after signing, even by one character; or an ES256/384/512 signature written in the DER format instead of the raw r and s values JWS requires.
Which keys can I use to check a signature?
For HS256, HS384 and HS512, the shared secret as plain text, base64url or base64. For RS, PS, ES and EdDSA tokens, a public key in PEM (BEGIN PUBLIC KEY or BEGIN RSA PUBLIC KEY), an X.509 certificate (BEGIN CERTIFICATE), a JWK, or a whole JWKS key set, from which the key whose kid matches the token is picked. A private key works too: the tool uses its public half.
Why is my secret called too short?
RFC 7518, which defines the JWT algorithms, says an HMAC key must be at least as long as the hash: 32 bytes for HS256, 48 for HS384 and 64 for HS512. A shorter secret still produces a signature, and this tool still checks it, but short secrets can be guessed by brute force, and some libraries refuse them.
Can it read an encrypted token (JWE)?
It recognises one by its five parts and shows its header, which says how it was encrypted. The content stays unreadable without the recipient’s private key, and this tool does not decrypt tokens. Most tokens you meet, such as OAuth access tokens and OpenID Connect ID tokens, are signed JWTs (JWS), which it reads completely.
Are JWTs encrypted? Can I put secrets in one?
A normal signed JWT is not encrypted: everything in its payload can be read by anyone who has the token, which is exactly what this page does. The signature only stops changes. Never put passwords, card numbers or other secrets in a JWT payload; use an encrypted JWE, or keep the data on the server and put only an ID in the token.