Ontoom

JWT encode / decode

Decode and validate JWT tokens, or create one with HS256 — in the browser.

With a secret, HS256 signature is verified.

Important: HS256 signing uses Web Crypto locally. Do not paste production secrets.

What a JWT is

A JSON Web Token (JWT), defined in RFC 7519, is a compact way to pass claims between systems, and it is everywhere in login flows and API calls. A signed JWT has three dot-separated parts: header.payload.signature. The header and payload are JSON objects encoded with Base64URL, a URL-friendly Base64 variant that swaps + for -, / for _ and drops the trailing = padding.

The key point: the payload is not encrypted. Anyone holding the token can read it, which is exactly what this tool does. The signature only proves the token was not changed by someone without the key. Never put passwords or personal data in a JWT payload.

What this tool does

Tokens signed with asymmetric algorithms such as RS256 or ES256 can be decoded, but their signatures are not verified here because that requires the issuer's public key.

  • Decode: splits the token, decodes the Base64URL parts and shows the header and payload as formatted JSON.
  • HS256 check: if you provide the secret, it recomputes the HMAC-SHA256 with the browser's Web Crypto API and tells you whether the signature matches.
  • Time warnings: flags tokens whose exp claim has passed or whose nbf claim is still in the future.
  • Encode: builds a new token from a JSON header and payload, signed with HS256 or unsigned (alg none) for testing.

How to use it

  1. On the Decode / validate tab, paste the token. If it came from an Authorization header, drop the Bearer prefix.
  2. Read the header (algorithm and type) and the payload (claims such as sub, iat and exp).
  3. To check an HS256 signature, enter the secret and click Decode and validate.
  4. To create a test token, switch to Encode, edit the header and payload, enter a secret and click Generate JWT.

Registered claims you will see

  • iss (issuer) and aud (audience): who created the token and who it is meant for.
  • sub (subject): usually the user ID.
  • iat (issued at), nbf (not before) and exp (expires): timestamps in seconds since 1970-01-01 UTC, not milliseconds.
  • jti: a unique token ID, handy for revocation lists.

Example payload

Here iat is 2026-01-01 00:00 UTC and exp is one hour later. A classic bug is setting exp from JavaScript's Date.now(), which is in milliseconds, producing a token that is valid for tens of thousands of years.

{
  "sub": "test-user-123",
  "role": "qa",
  "iat": 1767225600,
  "exp": 1767229200
}

Common security mistakes

  • Accepting alg none in production. The server should pin the expected algorithm and reject anything else.
  • Using a short or guessable HS256 secret. Use at least 32 random bytes; the password generator works for test environments.
  • Skipping exp, aud and iss checks on the backend. Decoding is not validating.
  • Storing sensitive data in the payload on the assumption that it is hidden.

Frequently asked questions

Is decoding a JWT the same as validating it?
No. Anyone can decode a JWT. Validating means checking the signature with the right key and checking claims such as exp, aud and iss.
Can I paste a production token here?
The tool runs in your browser and does not send the token to Ontoom, but good practice is to keep real tokens and secrets out of any website. Use test or staging tokens.
Why wasn't the signature verified?
Either the token uses an algorithm other than HS256, such as RS256, or you did not enter a secret. Verification here covers HMAC-SHA256 only.
What does the expired warning mean?
The exp claim is earlier than your computer's clock. Check that your clock is correct too, since even a few minutes of drift can trigger it.
Is a JWT encrypted?
A signed JWT (JWS), the common kind, is not. JWE tokens are encrypted, but they have five parts and are not handled by this tool.

Written by Orlando Alves · reviewed on · Editorial policy

See also