Skip to content

JWT Decoder

Paste a token to read its header and payload, see when it expires, and check an HMAC signature (HS256, HS384 or HS512). Nothing is sent to a server.

Encoded token
DecodedToken is still within its lifetime.
HEADERAlgorithm and token type
{ "alg": "HS256", "typ": "JWT" }
PAYLOADClaims
{ "sub": "user_8f3a21", "name": "Ada Lovelace", "role": "admin", "iss": "https://devtoolworld.com", "iat": 1792438972, "exp": 1792442572 }
isshttps://devtoolworld.com
subuser_8f3a21
iat10/19/2026, 7:42:52 PM1 second ago
exp10/19/2026, 8:42:52 PMin 59 minutes
SIGNATUREVerify with your secret
Signature valid

Last reviewed:

What is a JWT?

A JSON Web Token (JWT, defined in RFC 7519) is a compact way to pass a set of claims between two parties, most often from a login service to an API. It is three Base64URL-encoded segments joined by dots: a header that names the signing algorithm, a payload of claims such as the user ID (sub), issuer (iss), audience (aud) and expiry time (exp), and a signature computed over the first two segments.

The header and payload are only encoded, not encrypted. Anyone holding a token can read them, which is exactly what this tool does. What protects a JWT is the signature: with HMAC algorithms (HS256, HS384, HS512) it is created with a shared secret, and with RSA or ECDSA algorithms (RS256, ES256 and others) with a private key whose public key is used for verification. Changing a single character of the header or payload makes the signature invalid.

A server must therefore never trust a token because it decodes cleanly. It has to verify the signature with the expected algorithm and key, then check exp, nbf, iss and aud. Decoding is for reading and debugging; verification is for trusting.

How to use this tool

  1. Paste a token into Encoded token, or click Paste. Load sample creates a fresh HS256 token signed with the secret devtoolworld-demo. The three parts are coloured so you can see where each one starts.
  2. Read the decoded HEADER and PAYLOAD on the right. Each has a Copy button for the formatted JSON.
  3. Under the payload, a summary lists iss, sub, aud and jti if present, and shows iat, nbf and exp as dates in your local time with relative times such as "in 59 minutes" or "expired 3 days ago".
  4. The status line under the token says Decoded or Expired, or Invalid if the token cannot be parsed.
  5. To check the signature of an HMAC token, pick HS256, HS384 or HS512 (it is preselected from the header) and type the secret. The result shows Signature valid or Signature does not match.

Examples

Decoding a token

This token was signed with HS256 and the secret my-test-secret:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkFkYSBMb3ZlbGFjZSIsImlhdCI6MTc2MDAwMDAwMCwiZXhwIjoxNzYwMDAzNjAwfQ.QBPAgQ9igys517k3SGT--SWHNEfLZiL0AGn-D8cbaCU

Header:

{
  "alg": "HS256",
  "typ": "JWT"
}

Payload:

{
  "sub": "1234567890",
  "name": "Ada Lovelace",
  "iat": 1760000000,
  "exp": 1760003600
}

iat is 9 October 2025, 08:53:20 UTC and exp is one hour later, so the tool marks this token Expired. Entering my-test-secret with HS256 shows Signature valid; any other secret shows Signature does not match.

Spotting a tampered payload

If someone edits the payload above to add "role": "admin" and keeps the original signature, the middle segment becomes:

eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkFkYSBMb3ZlbGFjZSIsImlhdCI6MTc2MDAwMDAwMCwiZXhwIjoxNzYwMDAzNjAwLCJyb2xlIjoiYWRtaW4ifQ

The token still decodes and the new claim is visible, but verification with the correct secret fails. That is exactly the check a server relies on to reject forged tokens.

Common errors and how to fix them

  • "A JWT has three parts separated by dots. Found 1." You pasted only part of the token, or the whole Authorization header. Remove the Bearer prefix and make sure nothing was cut off when copying from a log or terminal.
  • Invalid after pasting from a URL or email. Line breaks or spaces were inserted into the token. Paste it into a plain text editor first and join it into one line.
  • Five parts instead of three. That is a JWE (an encrypted token). Its payload cannot be read without the decryption key.
  • Signature does not match with the right secret. Check the algorithm (HS256 versus HS512), trailing spaces or newlines in the secret, and whether your server Base64-decodes the secret before using it. Some libraries treat the configured secret as Base64 and others as plain text.
  • Token shows Expired but the API accepts it, or the reverse. Compare the server's clock with yours; validators also allow some clock skew, often 30 to 60 seconds.
  • Readable payload but a 401 from the API. Look at aud and iss. A token for another audience or issued by a staging identity provider is rejected even though the signature is fine.

When developers use this

  • Finding out why an API returns 401: expired token, wrong audience, missing scope or a token from the wrong environment.
  • Checking which roles, scopes or tenant ID an identity provider such as Auth0, Keycloak, Cognito or Entra ID actually put into a token.
  • Confirming a backend signs tokens with the secret and algorithm you expect after a configuration change or secret rotation.
  • Debugging token refresh logic by watching iat and exp on consecutive tokens.
  • Reading the kid header to see which signing key was used when keys are being rotated.

Privacy and how it works

Decoding uses the browser's Base64 and TextDecoder functions, and HMAC verification uses the Web Crypto API (crypto.subtle), all inside this tab. The token and the secret are never sent to our servers or stored. This matters because a valid access token is a credential: anyone who has it can call the API as that user until it expires. Prefer test or expired tokens anyway, and never paste a production signing secret into any website you do not control.

Limitations

  • Decoding is not validation. A readable payload proves nothing about who created it. Only a signature check with the right key, plus checks on exp, nbf, iss and aud, establishes that a token can be trusted.
  • Signature verification here supports HMAC tokens (HS256, HS384, HS512). Tokens signed with RS256, ES256 or other public-key algorithms are decoded but their signatures cannot be verified in this tool.
  • Encrypted tokens (JWE) cannot be decoded without the key.

FAQ

Is it safe to paste a production token here?

The token is processed only in your browser and never uploaded. Still, treat live tokens like passwords: anyone who sees your screen or clipboard history could reuse one until it expires. Use test tokens where possible.

Why can anyone read my token's payload?

JWT payloads are Base64URL-encoded JSON, which is a reversible format change, not encryption. The signature only proves the content was not modified. Never put passwords, secrets or sensitive personal data in a JWT.

What do iat, nbf and exp mean?

They are times in seconds since the Unix epoch: iat is when the token was issued, nbf is the earliest time it may be used and exp is when it expires. The tool shows them as local dates with relative times.

Why does verification need the secret?

An HMAC signature can only be recomputed by someone who has the same secret that created it. The tool computes the signature over the header and payload with your secret and compares it with the third segment. Without the secret, there is nothing to compare against.

What is the alg: none attack?

The JWT specification allows unsigned tokens with "alg": "none". Some early libraries accepted them, or let the token header choose the algorithm, so attackers could forge tokens. Servers must always enforce the expected algorithm themselves.

My token has a kid header. What is it?

kid (key ID) tells the verifier which key signed the token. Identity providers publish several keys in a JWKS endpoint during rotation, and the verifier picks the one whose ID matches.

Can this tool create or re-sign tokens?

No, it only decodes and verifies. Load sample generates a demo token for illustration, but there is no editor for creating your own signed tokens.

How long should access tokens live?

Short-lived access tokens, typically 5 to 15 minutes, limit the damage if one leaks, because JWTs usually cannot be revoked before they expire. Longer sessions are handled with refresh tokens that the server can revoke.

Guides