JWT Generator / Signer

Generate and sign JWT tokens using HS256, HS384, or HS512 directly in your browser. Edit header and payload JSON, set your secret, and copy the signed token — no data sent to servers.

  • Runs in your browser
  • Tool input is not uploaded to ZeroTool servers
  • Free · No Sign-Up
Algorithm
Choose HS256, HS384 or HS512. Selecting an algorithm updates alg in a JSON object Header. A manually edited alg must match the selection. Changes trigger signing after 0.5 seconds.
Enter a valid JSON object. Claims such as iat, exp and nbf stay as written; this tool does not add or check timestamps. Editing a field signs a new token after 0.5 seconds.
Use a test secret. Key length is measured after UTF-8 encoding or Base64 decoding. HS256, HS384 and HS512 require at least 32, 48 and 64 bytes respectively. Shorter keys still sign and show a warning. UTF-8 uses the entered text as key bytes. Base64 decodes the key first; standard and URL-safe alphabets are accepted, whitespace is ignored and padding is optional.
Header
Expand Header to edit its JSON. Its alg must match the selected algorithm. Outer whitespace is trimmed before signing; line breaks and indentation inside the Header and Payload are preserved.
Generated Token Copy copies the entire current token. Empty or invalid input clears the previous token. Ctrl+L (⌘+L on Mac) inside the tool clears all three fields and results, keeping the algorithm and secret format.

Enter valid Header and Payload JSON and a secret to see a signed token.

All processing is done locally in your browser.

Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Common Use Cases

  • Local development: Quickly generate tokens for testing API endpoints or auth flows without running a backend.
  • Debugging: Inspect how header and payload JSON is encoded into a JWT.
  • Documentation: Generate example tokens for API docs or README files.
  • Learning: Understand how JWTs are structured and signed.

Example: A Token for a Local API Test

Header (unchanged default) and payload as typed into the tool, with the UTF-8 secret dev-secret-at-least-32-bytes-long!!:

{
"alg": "HS256",
"typ": "JWT"
}
{
"sub": "user-42",
"role": "admin",
"iat": 1767225600,
"exp": 1767229200
}

Generated HS256 token:

ewogICJhbGciOiAiSFMyNTYiLAogICJ0eXAiOiAiSldUIgp9.ewogICJzdWIiOiAidXNlci00MiIsCiAgInJvbGUiOiAiYWRtaW4iLAogICJpYXQiOiAxNzY3MjI1NjAwLAogICJleHAiOiAxNzY3MjI5MjAwCn0.Bv_t0OCTXuNeir4XkkMmC0CJs8jGuy1knb6zZGgSRTs

The tool encodes the header and payload text exactly as typed, including line breaks and indentation, so this token is longer than one made from minified JSON (160 vs 125 characters before the signature). It is still a valid JWS. Verifying it with PyJWT:

import jwt  # PyJWT 2.10.1

token = "ewogICJhbGciOiAiSFMyNTYiLAogICJ0eXAiOiAiSldUIgp9.ewogICJzdWIiOiAidXNlci00MiIsCiAgInJvbGUiOiAiYWRtaW4iLAogICJpYXQiOiAxNzY3MjI1NjAwLAogICJleHAiOiAxNzY3MjI5MjAwCn0.Bv_t0OCTXuNeir4XkkMmC0CJs8jGuy1knb6zZGgSRTs"
key = "dev-secret-at-least-32-bytes-long!!"
print(jwt.decode(token, key, algorithms=["HS256"], options={"verify_exp": False}))
try:
  jwt.decode(token, key, algorithms=["HS256"])
except jwt.ExpiredSignatureError as e:
  print("ExpiredSignatureError:", e)

Output:

{'sub': 'user-42', 'role': 'admin', 'iat': 1767225600, 'exp': 1767229200}
ExpiredSignatureError: Signature has expired

iat 1767225600 is 2026-01-01 00:00:00 UTC and exp is one hour later, so a library that checks expiry rejects the token today. The tool does not add or check iat, exp or nbf; write the timestamps you need yourself (Unix seconds, RFC 7519 §4.1).

Editing Header alg to HS512 while HS256 remains selected shows an error and clears the previous token.

Example: The Same Key Text in UTF-8 and Base64 Mode

A key generated with openssl rand -base64 32 is 44 characters of Base64 text that stand for 32 random bytes. This demo key was made up for the page:

q83vEjRWeJCrze8SNFZ4kKvN7xI0VniQq83vEjRWeJA=

With compact JSON in both fields:

{"alg":"HS256","typ":"JWT"}
{"sub":"user-42","iat":1767225600}

Base64 mode signs with the 32 decoded bytes:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIiwiaWF0IjoxNzY3MjI1NjAwfQ.ObzNwrIiJoDqNA5f-RGsGcZB1_yg_YfeziEmaFgph6Q

UTF-8 mode signs with the 44 bytes of the text itself, so only the signature changes:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIiwiaWF0IjoxNzY3MjI1NjAwfQ.JQZj6nLnAjm412MFmVpVqGVWBXx3MVzFUWA6IvPHjVw

Neither mode shows a warning, because both keys are at least 32 bytes. A server that decodes the key before verifying accepts only the first token:

import base64
import jwt  # PyJWT 2.10.1

key = base64.b64decode("q83vEjRWeJCrze8SNFZ4kKvN7xI0VniQq83vEjRWeJA=")
base64_mode = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIiwiaWF0IjoxNzY3MjI1NjAwfQ.ObzNwrIiJoDqNA5f-RGsGcZB1_yg_YfeziEmaFgph6Q"
utf8_mode = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIiwiaWF0IjoxNzY3MjI1NjAwfQ.JQZj6nLnAjm412MFmVpVqGVWBXx3MVzFUWA6IvPHjVw"
print(jwt.decode(base64_mode, key, algorithms=["HS256"]))
try:
  jwt.decode(utf8_mode, key, algorithms=["HS256"])
except jwt.InvalidSignatureError as e:
  print("InvalidSignatureError:", e)

Output:

{'sub': 'user-42', 'iat': 1767225600}
InvalidSignatureError: Signature verification failed

Choosing a Key

An HMAC-signed JWT is only as strong as its secret. Anyone who holds one token can try candidate secrets offline until a signature matches; hashcat has a mode for exactly this (mode 16500, "JWT (JSON Web Token)"). RFC 8725 §3.5, the JWT best-practice document, warns that human-memorable passwords must not be used as HMAC keys. Generate random bytes instead and paste them in Base64 mode:

openssl rand -base64 32   # HS256
openssl rand -base64 64   # HS512

Select Base64 beside the Secret label so the tool signs with the decoded 32 or 64 bytes, the same bytes your server should load. If the server reads the key as a plain string instead, keep UTF-8 mode and paste the same text.

Limits

  • Only HMAC algorithms (HS256, HS384, HS512). RS256 and ES256 tokens need a private key and are not supported.
  • RFC 7518 §3.2 requires a key at least as long as the hash output: 32 bytes for HS256, 48 for HS384, 64 for HS512. The tool still signs with a shorter secret but shows a warning with the byte count; the default sample secret your-256-bit-secret is only 19 bytes and triggers it.
  • In Base64 mode the secret is decoded first (standard or URL-safe alphabet, padding optional). Use it when the server stores the key as Base64; otherwise the signature will not match.
  • The Payload must be a JSON object. An array, string, number or null shows an error instead of a token, because RFC 7519 §7.2 requires the claims to be a JSON object and libraries such as PyJWT reject anything else.
  • Header and Payload lose only their leading and trailing whitespace. In UTF-8 mode the secret is used exactly as typed, so a leading or trailing space changes the signature; Base64 mode ignores whitespace.
  • Half of an emoji (an unpaired UTF-16 surrogate) in the Header, the Payload or a UTF-8 secret is rejected with its position, because UTF-8 cannot encode it. In Base64 mode it is reported as invalid Base64.
  • Do not paste production signing secrets into any web page. Use a dedicated test secret.

FAQ

What is a JWT?

A JSON Web Token (JWT) is a compact, URL-safe token format defined in RFC 7519. It consists of three Base64URL-encoded parts separated by dots: a header (algorithm and type), a payload (claims), and a signature. JWTs are commonly used for authentication and information exchange.

Is my secret key sent to any server?

No. Signing uses the browser's built-in Web Crypto API (SubtleCrypto); the header, payload and secret are not sent anywhere. The tool does not save them, and stored values for this page are deleted each time it loads. Because the page handles secrets, it loads neither Google Analytics nor AdSense.

Which algorithm should I choose?

HS256 (HMAC-SHA256) is the most widely used and suits most cases; HS384 and HS512 use longer hashes. All three are symmetric: the same secret signs and verifies. Whichever you pick, RFC 7518 requires a key at least as long as the hash output: 32, 48 or 64 bytes.

How do I check that a token from this page verifies?

Verify it with any HMAC JWT library, using the same algorithm and the same key bytes. For example, with PyJWT 2.10.1: jwt.decode(token, key, algorithms=["HS256"]). In Base64 mode, pass the decoded bytes, not the Base64 text. The JWT Decoder on this site shows the claims but does not check the signature.

What is the Base64 secret format option?

Some services provide secrets pre-encoded in Base64 (or Base64URL). Select the Base64 option when your secret is already in that form — the tool will decode it before signing, producing the correct signature. The key length that counts is the decoded length: 44 Base64 characters decode to 32 bytes.

Why is my token longer than one made by a library for the same claims?

The tool signs the Header and Payload text exactly as typed, including line breaks and indentation; only leading and trailing whitespace is removed. Libraries usually serialize compact JSON. Both tokens are valid and verify with the same key. To get the compact form, paste minified JSON, for example {"alg":"HS256","typ":"JWT"}.