JWT generator for test tokens

Build a JSON Web Token for testing. Edit the header and payload, type a secret and this JWT generator signs the token in your browser with HMAC (HS256, HS384 or HS512). Use test secrets only, never production ones.

  • Free
  • No sign-up
  • Runs in your browser

Processing…

Runs in your browser — your text is never sent to our servers.

How to use JWT Generator

  1. Pick the "Algorithm": HS256, HS384 or HS512. Only HMAC algorithms are offered.
  2. Type a test value in "Secret". Tick "Show the secret" to check it, or "The secret is Base64-encoded" if the key is given in Base64.
  3. Edit "Header (JSON)" and "Payload (JSON)". Tick "Set iat to now", or choose an "Expires in (sets exp)" value and press "Add to payload".
  4. Copy the "Signed token" that appears as soon as a secret is entered, and read any warning about a short secret.

Features

  • Signs with HMAC using SHA-256, SHA-384 or SHA-512 (HS256, HS384, HS512)
  • Editable header and payload, both checked as JSON objects
  • The header alg value always matches the algorithm you choose
  • Adds iat (issued at) and exp (expires) in seconds since 1970
  • Expiry presets of 15 minutes, 1 hour, 24 hours, 7 days or 30 days
  • Optional Base64-decoded secret
  • Warns when the secret is shorter than the minimum in RFC 7518
  • Signs locally with the Web Crypto API, so nothing is sent to a server

Supported formats and limits

  • Maximum input: 1,000,000 characters

Examples

InputResult
Algorithm HS256, secret your-256-bit-secret, header {"alg":"HS256","typ":"JWT"}, payload {"sub":"1234567890","name":"John Doe","iat":1516239022}eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c — This secret is shorter than 32 bytes, so the short-secret warning appears. It is a well-known public sample secret.
Algorithm HS512, secret my-test-secret, header {"typ":"JWT"}, payload {"sub":"42","exp":1900000000}eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiIsImV4cCI6MTkwMDAwMDAwMH0.a8am-YgpeUbH_wuX4yJLF_lN5vhjrvIpjcZ3ykvYgZJ8QyDPcfz0f-QWq-wNGvEVHUCbYSbn8DLDqI1-bqrEw — The header had no alg, so HS512 is added to it. The secret is also too short for HS512.

Limitations

  • Do not paste production secrets. Signing happens in your browser, but browser extensions or a shared computer can still see what you type.
  • Only HMAC algorithms (HS256, HS384, HS512) are supported. RS256, ES256 and other asymmetric algorithms are not.
  • This tool creates tokens only. It does not verify a signature. The JWT decoder does not verify signatures either.
  • A JWT is signed, not encrypted. Anyone who has the token can read the payload, so never put secrets or passwords in it.
  • Header and payload must be JSON objects, and nothing is signed until a secret is entered.

Learn more

A JSON Web Token (JWT), defined in RFC 7519, has three parts separated by dots: header.payload.signature. The header and payload are JSON objects encoded with Base64URL, a URL-safe variant of Base64. This is encoding, not encryption, so anyone holding the token can read them.

The signature is a message authentication code. With HS256, HS384 or HS512 it is an HMAC (RFC 2104) of the first two parts, using SHA-256, SHA-384 or SHA-512 and a shared secret. A server that knows the same secret can recompute it and detect changes. RFC 7518 says the key should be at least as long as the hash output, which is why short secrets trigger a warning.

The payload carries claims. The registered ones are iss (issuer), sub (subject), aud (audience), exp (expiration time), nbf (not before), iat (issued at) and jti (token ID). The three time claims are whole seconds since 1 January 1970 UTC. Tokens made here are for testing your own code; real tokens should be signed on a server that keeps its key private.

Frequently asked questions

How do I generate a JWT?

Choose an algorithm, type a secret, edit the header and payload, and copy the signed token that appears. The token is built with HMAC in your browser.

Is it safe to use my real secret here?

No. Signing is local and the secret is not sent anywhere, but extensions or a shared device could see it. Use test secrets and create production tokens on your own server.

Is a JWT encrypted?

No. The header and payload are only Base64URL-encoded, so anyone can read them. The signature shows whether they were changed, but it does not hide them.

What are iat and exp?

iat is when the token was issued and exp is when it expires. Both are whole seconds since 1 January 1970 UTC.

Why do I see a short secret warning?

RFC 7518 says an HMAC key should be at least as long as the hash output (32 bytes for HS256, 48 for HS384 and 64 for HS512). Shorter secrets are easier to guess.

Sources

Last reviewed: September 30, 2026