Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

JWT Decoder

Sign a new token
Algorithm

Enter the secret to sign.

Signed in this tab; the secret isn’t saved or shared.

Token

Paste a JWT to decode it

A token: decoded here, not kept in recent work.
Decoded
Ready
Runs in your browser. Nothing you paste is uploaded unless you share it.

Decode a JSON Web Token’s header and payload, see exp, iat and nbf as dates, and check HS, RS, PS, ES or EdDSA signatures

Paste a JWT to read its header and claims, check when it expires, and verify its signature with the secret or the public key. The token and the key stay on your device.

How to use it

  1. Paste the token; a leading "Bearer" prefix is fine.
  2. Read the header and payload; exp, iat and nbf are shown as dates with "expires in …", and a time that looks like milliseconds is pointed out.
  3. Optional: enter the secret (HS256/384/512) or paste the public key (RS, PS, ES, EdDSA) to check the signature.
  4. To make a test token, choose Sign a token, edit the claims and sign with a secret or a private key.

Example

Decode the payload

Input
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKx…
Result
{
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
}

iat 1516239022 = 18 Jan 2018, 01:30:22 UTC.

The three parts of a JWT

A JWT is three Base64URL parts joined by dots: header.payload.signature. The header names the algorithm (alg) and often a key id (kid); the payload holds the claims; the signature covers the first two parts. Decoding needs no key, so anyone holding a token can read its payload: keep secrets out of it.

Sources: RFC 7519

Why decode tokens locally

A JWT is a bearer credential: whoever holds an unexpired token can call the API as that user. Pasting production tokens into a website that sends them to its server, or saves them, hands that access to someone else.

Here the token is split and Base64URL-decoded in your browser. Signature checks use the Web Crypto API, also in the browser, so the secret or key isn’t sent anywhere.

Verifying a JWT in code

Decoding reads a token; verifying proves it. Pin the algorithm you expect, as each call below does: a library left to trust the token’s own alg can be handed alg: none, or an HS256 token signed with your RS256 public key. The libraries also check exp and nbf; aud and iss you name yourself.

import { jwtVerify } from 'jose';

const key = new TextEncoder().encode(process.env.JWT_SECRET);
const { payload } = await jwtVerify(token, key, { algorithms: ['HS256'] });
// throws when the signature, exp or nbf fails

Sources: RFC 8725: JWT best current practices

When verification fails

What Node.js (jsonwebtoken) and Python (PyJWT) say, and what to look at here first:

  • Paste the token here: the header shows alg and kid, the claims show exp and nbf as dates, and the signature check says whether your secret or key matches.
Node.jsPythonUsual cause
jwt malformedNot enough segmentsNot three parts with two dots: "Bearer " or quotes copied along
invalid signatureSignature verification failedAnother secret or key; a Base64 secret used as text; the token was edited
jwt expiredSignature has expiredexp is past, or the server clock is ahead: allow a few seconds of leeway
jwt not activeThe token is not yet valid (nbf)nbf is in the future: clocks out of step
invalid algorithmThe specified alg value is not allowedThe header’s alg is not in your allowed list (RS256 sent, HS256 expected)
jwt audience invalid. expected: …Audience doesn’t matchaud names another API than the one checking it

Sources: jsonwebtoken: errors, PyJWT: exceptions

Registered claims

ClaimMeaning
issIssuer: who created the token
subSubject: usually the user id
audAudience: which API should accept it
expExpiry, Unix seconds: reject after this time
nbfNot before, Unix seconds: reject before this time
iatIssued at, Unix seconds
jtiUnique token id, so a token can’t be replayed

Sources: RFC 7519 §4.1

Questions

Does decoding a JWT prove it is valid?
No. Anyone can create a token with any payload. Only a signature check with the right key proves who issued it, and your server must also check exp, nbf, iss and aud.
Can it verify RS256, ES256 or EdDSA tokens?
Yes. Paste the public key and the page says “Signature valid” or “Signature does not match”, with the algorithm: RS256/384/512, PS256/384/512, ES256/384/512 and EdDSA (Ed25519). HS256, HS384 and HS512 are checked with the shared secret. Decoding works for every algorithm.
Which key formats can I paste?
A PEM public key (BEGIN PUBLIC KEY or BEGIN RSA PUBLIC KEY), a certificate (its key is used), a JWK, or a JWK set such as a /.well-known/jwks.json file, where the key with the token’s kid is picked. For HS tokens, the secret as text, or a JWK of type oct. A private key also works, only its public half is used, but checking needs just the public key.
What does alg "none" mean?
The token has no signature at all, so the page has nothing to check. An API must reject such tokens unless it expects them; accepting them by mistake is a known attack (RFC 8725 §2.1).
Can I make a signed test token?
Yes. Sign a token opens the decoded header and payload; edit them, pick the algorithm and enter an HS secret or paste a private key (PKCS#8 PEM or a private JWK). The token is signed in your browser and can be decoded here in one click.
My HS256 secret is Base64: why doesn’t the signature match?
Some servers keep the secret as Base64URL-encoded bytes. Turn on Base64URL beside the secret and the page decodes it before checking; when the other reading would match, the page says so.
Is the token, secret or key stored?
No. The token, the secret and the key stay in this browser tab: they aren’t sent unless you press Share; a shared result is locked with your password first. They aren’t kept in recent work, and are gone when you close it.

Related tools