JWT decoder and verifier
Runs in your browserDecode a JWT, see when it expires and verify the signature with a secret, PEM key or JWKS (HS256, RS256, ES256, PS256, EdDSA). Create test tokens.
Paste a JWT on the left
| Claim | Value | Meaning |
|---|
Signed in your browser. For RS256 and ES256 paste a private key; to make one: openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256. The token opens in the Decode tab with one click.
Three parts, separated by dots
A JSON Web Token is header.payload.signature. The first two are JSON, written in Base64url. That is an encoding, not encryption: anyone who has the token can read it. Only the signature is secret-dependent.
With HS256 the signature is an HMAC with a shared secret: whoever can check tokens can also create them. With RS256, PS256, ES256 or EdDSA the issuer signs with a private key and everyone checks with the public key, usually published as a JWKS. The kid in the header says which key it was.
Verify tokens in Node.js, Python, PHP and the shell
Decoding is easy, verifying is what matters. Always pin the algorithm instead of trusting the header.
import { jwtVerify, createRemoteJWKSet } from "jose";
// RS256/ES256: keys from the issuer's JWKS, picked by kid
const JWKS = createRemoteJWKSet(new URL("https://issuer.example/.well-known/jwks.json"));
const { payload } = await jwtVerify(token, JWKS, {
issuer: "https://issuer.example",
audience: "api",
});
// HS256: shared secret, and allow only that algorithm
await jwtVerify(token, new TextEncoder().encode(secret), { algorithms: ["HS256"] });import jwt # Always pass the algorithms you accept payload = jwt.decode(token, public_key_pem, algorithms=["RS256"], audience="api") # HS256 payload = jwt.decode(token, secret, algorithms=["HS256"])
use Firebase\JWT\JWT; use Firebase\JWT\Key; // composer require firebase/php-jwt $decoded = JWT::decode($jwt, new Key($publicKey, 'RS256')); $decoded = JWT::decode($jwt, new Key($secret, 'HS256'));
# Read the payload (no verification)
jq -R 'split(".") | .[1] | gsub("-";"+") | gsub("_";"/") | @base64d | fromjson' <<< "$TOKEN"
# Check an HS256 signature with openssl
SIG=$(printf '%s' "$(cut -d. -f1-2 <<< "$TOKEN")" \
| openssl dgst -sha256 -hmac "$SECRET" -binary | base64 | tr '+/' '-_' | tr -d '=')
[ "$SIG" = "$(cut -d. -f3 <<< "$TOKEN")" ] && echo validWhy tokens are rejected, or wrongly accepted
Some providers show or store the secret Base64-encoded and decode it before signing. Switch “Secret is” to Base64 above. The tool tells you when that is the fix.
If a server verifies with whatever alg the token says, an attacker can sign an HS256 token with the server’s public key as the secret. Always allow only the algorithms you expect.
An unsigned token. Libraries must reject it unless you explicitly allow it. This tool warns about it.
JWT times are seconds since 1970. Date.now() gives milliseconds, so the token seems to be valid for 50,000 years.
A token issued a few seconds “in the future” fails on a server whose clock is behind. Allow 30–60 seconds leeway for iat and nbf.
The issuer rotated its keys. Reload the JWKS, and cache it with a refresh instead of forever.
Questions about the JWT decoder
Is it safe to paste my JWT here?
The token is decoded and checked in your browser; nothing is sent to a server. You can watch the Network tab in your developer tools while you paste. Still, a valid access token is a password for as long as it lives, so prefer expired or test tokens when you can.
Can a JWT be decrypted?
A normal JWT (JWS) is not encrypted, so there is nothing to decrypt: header and payload are only Base64url-encoded and readable by anyone. Encrypted tokens (JWE) have five parts instead of three and need the recipient’s private key.
What does “invalid signature” mean?
The signature does not match header and payload with the key you used. Either the token was changed, or the key is a different one: another secret, a secret that must be Base64-decoded first, or a rotated signing key (check the kid).
What is the difference between HS256 and RS256?
HS256 uses one shared secret to sign and verify (an HMAC with SHA-256). RS256 signs with an RSA private key and verifies with the public key, so services that only verify never hold a key that can create tokens.
How long is an exp of 1893456000?
It is a Unix timestamp in seconds. The tool shows every time claim as a date and as “in 2 hours” or “3 days ago”; 1893456000 is 1 January 2030, 00:00 UTC.
Where do I find the public key to verify?
Most issuers publish a JWKS at /.well-known/jwks.json (listed in /.well-known/openid-configuration). Open it in your browser and paste the JSON into the key field. The tool picks the key by kid. It never fetches URLs itself.