utilapp.net

JWT Decoder

Decode a JSON Web Token's header and payload, check exp, nbf and iat against the current time, and verify HS, RS, PS or ES signatures in your browser.

Decoded in your browser. The token is not sent anywhere.

How to decode and verify a JWT

  1. 1

    Paste the token

    Paste the JWT into the input. A leading "Bearer " and line breaks are removed.

  2. 2

    Read the header and payload

    Both are shown as formatted JSON. exp, nbf and iat are converted to local and UTC dates.

  3. 3

    Check the status

    The badge shows whether the token is expired, not yet valid, not expired, or has no exp claim.

  4. 4

    Verify the signature

    Enter the HMAC secret, or paste the issuer's public key as PEM, JWK or JWKS, and click Verify.

JWT notes for debugging

Structure

A signed JWT is three base64url segments joined by dots: header.payload.signature. The header names the algorithm (alg) and often a key ID (kid). The signature covers the ASCII bytes of the first two segments exactly as they appear in the token, so re-encoding the JSON with different whitespace or key order invalidates it. A token with five segments is a JWE: its payload is encrypted and cannot be decoded without the key.

Decoding is not verifying

Anyone can decode a JWT, because base64url is an encoding, not encryption. A server should trust the claims only after checking the signature with a key it already has, and then checking exp, nbf, iss and aud. It should not take the algorithm or the key from the token itself; keep a fixed list of accepted algorithms per key.

alg "none" and algorithm confusion

RFC 7519 defines unsecured JWTs with alg set to "none" and an empty signature. A library that accepts them lets anyone forge tokens, which is why this page flags them. A related bug: a server that passes its RSA public key to a generic verify function may accept an HS256 token whose HMAC secret is that public key, which an attacker can download. Pin the expected alg for each key.

Time claims

exp, nbf and iat are seconds since the Unix epoch, not milliseconds. A token is expired when the current time is at or after exp, and must not be accepted before nbf. Servers usually allow 30 to 60 seconds of clock skew; this page compares against your device clock with no leeway.

Finding the verification key

HS256/384/512 use one shared secret. Some providers issue the secret base64-encoded; tick the base64 option in that case, otherwise the UTF-8 bytes of the text are used. RS, PS and ES tokens need the issuer's public key. OpenID Connect providers publish it as a JWKS at the jwks_uri listed in /.well-known/openid-configuration. To get a public key from a certificate, run openssl x509 -in cert.pem -pubkey -noout. To convert a PKCS#1 key (BEGIN RSA PUBLIC KEY), run openssl rsa -RSAPublicKey_in -in key.pem -pubout.

Frequently Asked Questions