Skip to content
CornerTools

JWT Decoder & Encoder

Decode a JSON Web Token, verify its signature with a secret or public key, or sign a new one.

1
1
Mode

Decodes a JSON Web Token (JWT) to show its header and payload as readable JSON, checks its signature with a secret or public key, and signs new tokens. Its issue and expiry times are spelled out and judged apart from the signature, so an expired token with a good signature reads as exactly that.

Everything runs in your browser with its built-in Web Crypto: tokens, secrets and keys are never sent anywhere and never stored, and none of them goes into the page's link. Still, treat real tokens and keys like passwords.

Signature and time, said apart

Signature verified means the header and payload are exactly what the holder of the key signed. Invalid signature means they were changed, or the key is not the one that signed them. Below it, the time line says whether the token has expired or is not yet valid, read against your device's clock with no leeway, and prints the instant in UTC. A server may allow a few minutes of leeway for clock skew (RFC 7519 §4.1.4), so a token that expired seconds ago here may still pass there; a large gap between the time shown and the real time means a clock is wrong.

A token with "alg": "none" has no signature and is never reported as verified. A key that does not fit the token's alg is refused, naming both: an EC key for RS256, a P-384 key for ES256, or a public key offered as an HS256 secret. That last is the algorithm-confusion attack in RFC 8725 §2.1: a server that lets the token choose its algorithm can be tricked into checking an HMAC made with its own public key, which anyone can have. A safe server fixes the algorithm for each key.

A header with crit lists extensions the recipient must understand, such as RFC 7797's unencoded payload (b64). This tool supports none, so such a token is reported invalid, as RFC 7515 §4.1.11 requires.

RSA keys under 2,048 bits and HMAC secrets shorter than the hash (32 bytes for HS256) are flagged, since RFC 7518 requires more. ES256K and Ed448 are refused, as Web Crypto lacks their curves. EdDSA needs Ed25519 in Web Crypto, which arrived in Chrome and Edge 137, Firefox 129 and Safari 17.

How to use it

Decode: paste the token — three parts separated by dots — or a whole Authorization value: a leading Bearer is dropped. The header and payload appear below it, with iat, nbf and exp in UTC and how long ago or ahead each is. Pretty JSON indents the output; Trim input removes spaces and line breaks, so a token copied across lines still decodes.

To verify, fill in the field under the payload. For HS256, HS384 and HS512 it takes the shared secret, read as UTF-8 Text or as Base64 (either alphabet), or an oct JWK. For RS, PS, ES and EdDSA it takes the public key as PEM (BEGIN PUBLIC KEY or BEGIN RSA PUBLIC KEY), an X.509 certificate (BEGIN CERTIFICATE), a JWK, or a JWK Set as an identity provider publishes it. From a set, the key whose kid matches the token's is used; with no kid, each key of the right type is tried and the one that verified is named. A private key works too: its public half is used.

Encode: edit the header and payload as JSON and choose the Algorithm, which sets the header's alg. Set time writes iat, nbf or exp from your device's clock. Sign with a secret, or a private key as PEM (BEGIN PRIVATE KEY, BEGIN RSA PRIVATE KEY or BEGIN EC PRIVATE KEY) or a private JWK. Generate key pair makes a new pair for the chosen algorithm and shows both PEMs; Generate secret makes a random secret as long as the hash. The token updates as you type; Verify opens it in Decode with the matching key.

Examples

Reading a token

Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkFubmEiLCJpYXQiOjQxMDI0NDEyMDAsImV4cCI6NDEwMjQ0NDgwMH0.c2lnbmF0dXJl
Header
{"alg":"HS256","typ":"JWT"}
Payload
{
  "sub": "1234567890",
  "name": "Anna",
  "iat": 4102441200,
  "exp": 4102444800
}

Its exp of 4102444800 is 1 January 2100, 00:00:00 UTC: 60 minutes after it was issued (iat).

Verifying RFC 7515's HS256 example

Token
eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
Verify with secret
AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow
Secret is
Base64
Result
Signature verified

With Secret is set to Text, the same secret gives “Invalid signature”, as its bytes differ. The signature is good, but its exp of 1300819380 is 22 March 2011, 18:43:00 UTC, so the time line reports it expired.

A public key offered as an HMAC secret

Token
The HS256 token above
Verify with secret
{"kty":"EC","crv":"P-256","x":"f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU","y":"x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0"}
Result
HS256 needs a shared secret, but this is an EC P-256 public key. Treating it as an HMAC secret is the algorithm-confusion attack (RFC 8725 §2.1), so it is refused

Algorithms and claims

Signing algorithms and the key each takes
algSignatureKey
HS256HMAC with SHA-256a secret of 32 bytes or more
HS384HMAC with SHA-384a secret of 48 bytes or more
HS512HMAC with SHA-512a secret of 64 bytes or more
RS256, RS384, RS512RSASSA-PKCS1-v1_5 with SHA-2an RSA key of 2,048 bits or more
PS256, PS384, PS512RSASSA-PSS with SHA-2an RSA key of 2,048 bits or more
ES256ECDSA with SHA-256an EC P-256 key
ES384ECDSA with SHA-384an EC P-384 key
ES512ECDSA with SHA-512an EC P-521 key
EdDSAEd25519 (RFC 8037)an Ed25519 key
Registered claims defined in RFC 7519
ClaimNameMeaning
issIssuerWho created the token
subSubjectWho the token is about, usually a user ID
audAudienceWho the token is meant for
expExpiration timeWhen it stops being valid, in seconds since 1970 (UTC)
nbfNot beforeWhen it starts being valid
iatIssued atWhen it was created
jtiJWT IDA unique ID, used to prevent reuse

Standards

The token format, its Base64url parts without padding and the signing input follow RFC 7515; the algorithms, key sizes, PSS salt length and ECDSA's fixed-width r‖s signature follow RFC 7518; EdDSA follows RFC 8037; claims and their times follow RFC 7519; the refusals follow RFC 8725's best practices. The verification examples are RFC 7515's own test vectors.

Sources

Reviewed

See also