JWT decoder and signer

Decode, edit, sign and verify JWTs.

loading JWT decoder and signer
About this tool

What is a JWT?

A JSON Web Token (JWT, RFC 7519) is a compact string that carries a set of claims (who the user is, what they may do, when the token expires) together with a signature that proves nobody changed them. It has three parts separated by dots: the header (the algorithm, such as HS256), the payload (the claims) and the signature. The first two are JSON encoded in Base64URL, which is why every JWT starts with eyJ, the Base64 of {" (any part can also be read with the Base64 decoder).

The payload is encoded, not encrypted: anyone who holds the token can read it, so never put passwords or private data in one. What a server must check is the signature. With HMAC algorithms (HS256, HS384, HS512) the same shared secret signs and verifies; with RSA (RS, PS), elliptic curves (ES) and EdDSA a private key signs and the public key verifies.

This JWT decoder and signer runs in your browser, so tokens and keys never leave the page. It decodes the parts as you paste, verifies the signature with your secret or public key, shows each claim with its date and status, and warns about risky tokens: algorithm none, a secret that is too short, a missing exp or a header that points to a key URL. It also signs: edit the header or payload, add a key, and you get a new token.

How to decode and verify a JWT

  1. Paste the token in Paste a JWT, or edit the parts below. It opens with an example token; replace it with yours. Paste only the token, without the word Bearer.
  2. The token is shown in color by part, and the Header and Payload boxes show each part decoded.
  3. Look at the Claims table: exp, iat and nbf are Unix timestamps shown as dates, with a status such as expired (for any other timestamp, use the date converter).
  4. To check the signature, open Key. For HS256/HS384/HS512 type the Secret (tick The secret is Base64URL-encoded if it is stored that way). For RS, PS, ES and EdDSA paste the Public key (PEM, JWK or JWKS), to verify.
  5. The status tag above changes to Signature valid or Signature invalid. Any warnings appear right below it.
  6. To create or change a token, edit the Header or Payload, or pick another Algorithm: with a key present, the token is signed again on each edit. For RS, PS, ES and EdDSA paste the Private key (PKCS#8 PEM or JWK), to sign, or press Generate an example key pair.
  7. Press Copy token to take the result.

Examples

Decode a token and check its signature

Input (HS256, signed with the secret toolbox-dev-example-secret-of-32-bytes+):

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUgRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTc2NzIyNTYwMCwiZXhwIjoxNzY3MjI5MjAwfQ.wt1M4PG8dWy-FU6-oZltnGdjhAppMji7Y6Csh_B_rx4

Header and payload:

{ "alg": "HS256", "typ": "JWT" }
{
  "sub": "1234567890",
  "name": "Jane Doe",
  "admin": true,
  "iat": 1767225600,
  "exp": 1767229200
}

The Claims table turns iat and exp into dates in your time zone: 2026-01-01 00:00 and 01:00 UTC. The token lived one hour, so it is now marked as expired. With the right secret the status is Signature valid; with any other secret, Signature invalid.

Edit the payload and sign again

With the secret above still in the Key box, change "admin": true to "admin": false. The tool signs the new content at once:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUgRG9lIiwiYWRtaW4iOmZhbHNlLCJpYXQiOjE3NjcyMjU2MDAsImV4cCI6MTc2NzIyOTIwMH0.xYqUsxC99nsUN4bDh7tBfJhJ07VEEtM3bDBtRnrWOvI

Only the middle part and the signature change; without the key, an edited payload would keep a signature that no longer matches.

A secret that is too short

A token signed with HS256 and the secret secret:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1MSIsImlhdCI6MTc2NzIyNTYwMH0.kXlJg0AKxh1PWSaLMHuPB_B3qI7MRIekfhxA-FILpkA

Two warnings appear: the secret is shorter than 32 bytes, the minimum for HS256, so it can be guessed by brute force; and the token has no exp, so it never expires. Generate a random secret creates a 48-byte secret in Base64URL instead.

An unsigned token (alg none)

eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJ1MSIsInJvbGUiOiJhZG1pbiJ9.

The header says "alg": "none" and the signature part is empty. The tool warns that such a token has no protection and must never be accepted by a server: anyone can write "role": "admin" in it.

Common errors and how to fix them

  • This is not a JWT: it needs three parts separated by dots: the text has fewer or more than two dots. Copy the whole token; a JWE (encrypted token) has five parts and cannot be read without its key.
  • The header (first part) is not valid Base64URL-encoded JSON: usually the token was pasted with Bearer in front, or with quotes. Paste only the part that starts with eyJ.
  • Signature invalid: the secret or public key is not the one that signed the token (or is of another type, such as an RSA key for an ES256 token; the message next to the status says so), the secret is Base64URL but the checkbox is off (or the reverse), or the token was edited after signing.
  • Key does not fit this token: the private key was pasted where the public key goes (the message says to use the BEGIN PUBLIC KEY one), or the key text is incomplete and cannot be read. Copy the full PEM, including the BEGIN and END lines.
  • This token has expired: exp is in the past. Get a new token; check also that the server and client clocks agree.

Frequently asked questions

Is it safe to paste a JWT here?

The token never leaves your browser. Still, a valid access token is a credential: prefer test tokens, and keep production signing keys out of tools you do not control.

What is the difference between HS256 and RS256?

HS256 uses one shared secret to sign and verify, so every service that verifies could also issue tokens. RS256 signs with a private key and verifies with a public key, which can be published (often as a JWKS). The tool supports HS256, HS384, HS512, RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512 and EdDSA.

How do I create a JWT online?

Write the header and payload, choose the algorithm, add the secret or private key, and copy the signed token. The JWT generator page opens the tool ready for that. A strong random secret can also come from the token generator.

How to decode and sign a JWT in code

JavaScript

jose works in Node.js, browsers and edge runtimes. decodeJwt only reads; jwtVerify checks the signature and the dates.

import { SignJWT, decodeJwt, jwtVerify } from 'jose';

const secret = new TextEncoder().encode('toolbox-dev-example-secret-of-32-bytes+');
const token = await new SignJWT({ name: 'Jane Doe', admin: true })
  .setProtectedHeader({ alg: 'HS256', typ: 'JWT' })
  .setSubject('1234567890')
  .setIssuedAt()
  .setExpirationTime('1h')
  .sign(secret);

decodeJwt(token);                                 // payload, signature NOT checked
const { payload } = await jwtVerify(token, secret); // throws if invalid or expired

Python

With PyJWT (pip install PyJWT). Always pass algorithms when decoding, so a token cannot choose its own algorithm.

import jwt

secret = "toolbox-dev-example-secret-of-32-bytes+"
token = jwt.encode({"sub": "1234567890", "name": "Jane Doe", "exp": 1767229200}, secret, algorithm="HS256")
try:
    claims = jwt.decode(token, secret, algorithms=["HS256"])
except jwt.ExpiredSignatureError:
    print("expired")

Go

With only the standard library, an HS256 token is HMAC-SHA256 over header.payload, both in unpadded Base64URL. This prints the token of the first example.

enc := base64.RawURLEncoding
header := enc.EncodeToString([]byte(`{"alg":"HS256","typ":"JWT"}`))
payload := enc.EncodeToString([]byte(`{"sub":"1234567890","name":"Jane Doe","admin":true,"iat":1767225600,"exp":1767229200}`))
mac := hmac.New(sha256.New, []byte("toolbox-dev-example-secret-of-32-bytes+"))
mac.Write([]byte(header + "." + payload))
fmt.Println(header + "." + payload + "." + enc.EncodeToString(mac.Sum(nil)))

Bash

Read the payload with jq, and sign with openssl.

echo "$TOKEN" | jq -R 'split(".") | .[1] | gsub("-";"+") | gsub("_";"/") | @base64d | fromjson'

b64url() { base64 | tr '+/' '-_' | tr -d '=\n'; }
input="$(printf '%s' '{"alg":"HS256","typ":"JWT"}' | b64url).$(printf '%s' '{"sub":"u1"}' | b64url)"
sig=$(printf '%s' "$input" | openssl dgst -sha256 -hmac "$SECRET" -binary | b64url)
echo "$input.$sig"
Report a problem