hackandhost

Blog · · 3 min read

JWT decoder

Paste a JSON Web Token to read its header and claims, see when it expires in your time zone, and check its signature. Nothing leaves your browser.

A JWT looks like random text, but most of it is plain JSON that anyone can read. Paste a token below to see what's inside, when it expires, and whether its signature is genuine. Decoding and verification both happen in your browser, so the token and your key are never sent anywhere.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiJ1c2VyXzU1MSIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbSIsIm5hbWUiOiJQcml5YSBOYWlyIiwiZW1haWwiOiJwcml5YS5uYWlyQGV4YW1wbGUuY29tIiwicm9sZXMiOlsiZWRpdG9yIl0sInNjb3BlIjoicG9zdHM6cmVhZCBwb3N0czp3cml0ZSIsImlhdCI6MTc5NjA0MDAwMCwibmJmIjoxNzk2MDQwMDAwLCJleHAiOjE5NTM4NDk2MDAsImp0aSI6IjhmMmMxZTBhLTViN2QtNGYzZS05YTYxLTJkNGM3YjBlOWYxMyJ9.qSGf_kW9Kcs1xLxsRr1mJoqKmfBn-o5PlCdKj-4bgeQ

Header Payload Signature

Decoded and checked in your browser. The token and key are never sent anywhere or saved.

Header
{
  "alg": "HS256",
  "typ": "JWT"
}
algSigning algorithm
typToken type
Payload
{
  "iss": "https://auth.example.com",
  "sub": "user_551",
  "aud": "api.example.com",
  "name": "Priya Nair",
  "email": "priya.nair@example.com",
  "roles": [
    "editor"
  ],
  "scope": "posts:read posts:write",
  "iat": 1796040000,
  "nbf": 1796040000,
  "exp": 1953849600,
  "jti": "8f2c1e0a-5b7d-4f3e-9a61-2d4c7b0e9f13"
}
Verify signature HS256

Enter the secret to check the signature.

Claims
isshttps://auth.example.com
Issuer: who created and signed the token
subuser_551
Subject: who the token is about, usually a user ID
audapi.example.com
Audience: who the token is meant for; an API should reject tokens not addressed to it
namePriya Nair
User's full name
emailpriya.nair@example.com
User's email address
roles["editor"]
Roles assigned to the user
scopeposts:read posts:write
Permissions granted, separated by spaces
iatNov 30, 2026, 12:00:00 PM
1796040000
Issued at: when the token was created
nbfNov 30, 2026, 12:00:00 PM
1796040000
Not before: the token must be rejected before this time
expDec 1, 2031, 12:00:00 AM
1953849600
Expires at: the token must be rejected after this time
jti8f2c1e0a-5b7d-4f3e-9a61-2d4c7b0e9f13
JWT ID: a unique ID, used to stop the same token being replayed

What's in a token

A JWT is three pieces of base64url text joined by dots:

header.payload.signature
  • Header: which algorithm signed the token (alg), and often which key (kid).
  • Payload: the claims: who the token is about (sub), who issued it (iss), who it's for (aud), and when it expires (exp).
  • Signature: proof that the header and payload haven't been changed since the issuer signed them.

Base64url is an encoding, not encryption. Anyone holding the token can read the payload, so never put passwords, API keys or other secrets in it. If you need the contents hidden, that's a different format, JWE, which has five parts instead of three.

Decoding is not verifying

Reading a payload tells you what the token claims. Only the signature tells you whether to believe it. A server must verify the signature before trusting anything in the token, and should also check:

  • exp and nbf, allowing a minute or so for clock differences between servers
  • iss is the issuer you expect
  • aud includes your API, so a token meant for another app can't be used on yours

The time claims are in seconds since 1970, not milliseconds. Comparing exp with Date.now() without dividing by 1000 is a classic bug that makes every token look valid for thousands of years.

Which key do I need?

It depends on the alg in the header:

Algorithm Key used to verify
HS256, HS384, HS512 The same shared secret that signed it
RS256, PS256, ES256 and similar The issuer's public key
EdDSA The issuer's Ed25519 public key

With HS*, anyone who can verify a token can also create one, so the secret must stay on your servers. With RS*, PS* and ES*, the issuer keeps the private key and publishes the public key, usually as a key set at /.well-known/jwks.json on the issuer's domain. You can paste that whole key set into the tool; it picks the right key using the token's kid.

Doing it in code

In Node, you can read a payload without any library:

const [, payload] = token.split(".");
const claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));

For verification, use a maintained library rather than writing it yourself. With jose:

import { createRemoteJWKSet, jwtVerify } from "jose";

const JWKS = createRemoteJWKSet(
  new URL("https://auth.example.com/.well-known/jwks.json"),
);

const { payload } = await jwtVerify(token, JWKS, {
  issuer: "https://auth.example.com",
  audience: "api.example.com",
});

jwtVerify checks the signature, exp and nbf, the issuer and the audience in one call, and throws if any of them fail.

Two attacks to know about

  • alg: none. A token can claim it has no signature at all. Libraries reject it by default now, but code that reads alg from the token and does whatever it says can be fooled. The tool flags these tokens.
  • Algorithm confusion. If a server expects RS256 but accepts whatever alg the token names, an attacker can sign a token with HS256, using the server's public key as the shared secret. Always tell your library which algorithms to accept instead of trusting the header.

Finally, be careful where you paste real tokens. A valid access token works like a password until it expires, and online decoders can log what you paste. This one runs entirely in your browser, but for production tokens, decoding locally with the two lines of code above is safest.