JWT decoder and verifier

Runs in your browser

Decode 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.

Waiting for a token

Paste a JWT on the left

Header
Payload
How a JWT is built

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.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9Header: algorithm and type
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUgRG9lIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNzYzNjQwMDAwLCJleHAiOjE4OTM0NTYwMDB9Payload: the claims
xK4kFc0kOLfdTHSV-02nizLmpv61Er7dG4bcL-NpkUYSignature over header.payload

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.

In your code

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.

Node.js (jose)
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"] });
Python (PyJWT)
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"])
PHP
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'));
Command line
# 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 valid
Common mistakes

Why tokens are rejected, or wrongly accepted

“invalid signature” with the right secret

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.

Algorithm confusion

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.

alg: none

An unsigned token. Libraries must reject it unless you explicitly allow it. This tool warns about it.

exp in milliseconds

JWT times are seconds since 1970. Date.now() gives milliseconds, so the token seems to be valid for 50,000 years.

Clock skew

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.

kid not found

The issuer rotated its keys. Reload the JWKS, and cache it with a refresh instead of forever.

FAQ

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.

Searches the list of pages on this site. What you type stays in your browser.