JWT decoder
Everything runs in your browser; nothing is sent or stored.
- Paste a JWT of up to 100 KB, with or without the Bearer prefix. The token is decoded as you type. Decoding does not verify the token, and the content of a JWT is readable by anyone who holds it, so it must not contain secrets.
- The header and the payload are shown as formatted JSON, along with the algorithm (alg) and the type (typ).
- In the "Standard claims" section, times are shown as a date in your device's time zone and as a relative time.
- The validity status is based on exp and nbf: valid, expired, or not valid yet. The status and the times follow the browser clock.
- To verify the signature, enter the secret key. For a Base64-encoded key, check the "The key is Base64 encoded" option.
- Copy the header, the payload, or the signature with the "Copy" button.
JWT structure
A JWT (JSON Web Token), defined in RFC 7519, has three parts separated by dots: the header, the payload, and the signature. The header and the payload are JSON objects encoded in Base64url, a variant of Base64 in which the characters - and _ replace the characters + and /, and the = padding at the end is dropped. A JSON object usually starts with the characters {", so a JWT almost always starts with eyJ. The signature is calculated over the first two parts, using the algorithm set in the alg field of the header.
Decoding and signature verification
Base64url encoding is not encryption, so anyone who holds a token can read its content. For this reason, the payload must never include passwords or other secret information. Decoding does not prove that a token is genuine. Only signature verification proves that the token was created by someone who holds the key and that its content was not changed. With the HS256, HS384, and HS512 algorithms, the signature is calculated with HMAC and a shared secret key, which is used both to create the token and to verify it. With algorithms such as RS256, ES256, and EdDSA, the token is signed with a private key and verified with a public key. A token with the value none in the alg field is not signed at all, and the decoder shows a warning for it.
Standard claims
The iss claim identifies the issuer of the token, the sub claim identifies the subject, usually the user ID, and the aud claim identifies the audience, meaning the system the token is intended for. The jti claim is a unique token ID that makes it possible to detect reuse. The exp, nbf, and iat claims set the expiration time, the start of validity, and the issue time, as a Unix timestamp in seconds. The token expires at the moment set in the exp claim. Other claims, such as a name or permissions, are shown in the payload.
Examples
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9the header {"alg":"HS256","typ":"JWT"} encoded in Base64url.eyJhbGciOiJub25lIn0the header {"alg":"none"} of a token that is not signed.your-256-bit-secretthe secret key of the sample token shown in the tool, for testing signature verification."iat": 1516239022the issue time of the sample token: January 18, 2018, 01:30:22 (UTC)."exp": 1700000000an expiration time: November 14, 2023, 22:13:20 (UTC).
JWT decoder FAQ
Can I decode a JWT without the secret key?
Yes. You can decode the header and the payload without the secret key, which is needed only to verify the signature. When the "Secret key (optional)" field is empty, the token is decoded as usual, and a message asks you to enter the key to verify the signature.
Why does a message say the signature is not valid?
The message appears when the signature calculated with the key you entered differs from the signature in the token. The common causes are a wrong key, an extra space at the start or end of the key, and a Base64-encoded key entered without checking the "The key is Base64 encoded" option. Changing even one character in the header or the payload after signing also causes the message.
Can I verify a token signed with RS256 or ES256?
No. The decoder verifies HMAC signatures only, with the HS256, HS384, and HS512 algorithms. For a token signed with RS256, ES256, or another public-key algorithm, a message says that verification is not supported, and the header, the payload, and the standard claims are decoded as usual.
Why is the validity status different from what I expected?
The status is based on your device's clock, so an inaccurate clock changes the result. In addition, the exp value must be in seconds. A value in milliseconds is read as a time far in the future, so a token with exp in milliseconds is shown as valid. The expiration time appears in the "Expires (exp)" row, along with the relative time.
What does a token with five parts mean?
A token with five parts separated by dots is an encrypted JWE token. The content of an encrypted token can be read only by someone who holds the decryption key, so the decoder shows a message that the token is encrypted and does not show its content.
Why does a message say a part of the token is not valid Base64url?
The message appears when a part of the token contains a character that is not allowed in Base64url, such as a space, a line break, the + character, or the = character. A line break is often added when you copy a token from a log file or a message, so copy the token as one continuous line.