JWT Generator

Build and sign JSON Web Tokens in-browser with a custom payload, secret key, and algorithm (HS256, HS384, HS512). No data is sent to a server — all signing uses the WebCrypto API.

Header

Secret Key

The secret key is used to sign the token. Keep it private and never share it.

Payload

Generated Token

Share this tool

Help others discover JWT Generator

About JWT Generator

How It Works

  • Fill in the JSON payload with the claims you want to include.
  • Choose a signing algorithm (HS256, HS384, HS512, or none).
  • Enter a secret key for HMAC algorithms.
  • The tool uses the WebCrypto API to sign the token entirely in your browser.
  • Copy the generated JWT to use in your API requests or tests.

Common Use Cases

  • Testing JWT-protected API endpoints locally
  • Generating tokens for development and staging environments
  • Learning and understanding JWT structure
  • Creating sample tokens for documentation or demos
  • Debugging authentication flows without a backend

Frequently Asked Questions

What is a JWT and why would I need to generate one?

A JSON Web Token (JWT) is a compact, URL-safe token format defined by RFC 7519. It is commonly used for authentication and secure information exchange in web applications and APIs. You might need to generate a JWT to test a protected API endpoint, create sample tokens for documentation, or debug an authentication flow without running a backend.

Is it safe to use this tool with a real secret key?

This tool runs entirely in your browser using the WebCrypto API. No data is ever sent to a server. However, we recommend using a test/dummy secret key here rather than your real production secret, as best practice dictates never entering sensitive credentials into third-party websites.

What algorithms does this tool support?

The tool supports HS256 (HMAC-SHA256), HS384 (HMAC-SHA384), and HS512 (HMAC-SHA512) — the most widely used symmetric signing algorithms for JWTs. It also supports "none" (unsigned token) for testing purposes. Asymmetric algorithms like RS256 or ES256 require a private key and are not supported here.

What is the difference between HS256, HS384, and HS512?

All three are HMAC-based signing algorithms that differ only in the SHA hash function used: HS256 uses SHA-256 (256-bit signature), HS384 uses SHA-384, and HS512 uses SHA-512. HS256 is by far the most common choice. Use HS384 or HS512 if you need a stronger signature or your infrastructure requires it. All three are considered secure when used with a strong secret.

What should I put in the JWT payload?

The payload is a JSON object containing "claims" — key-value pairs about the subject (user) or session. Standard registered claims include: sub (subject/user ID), iss (issuer), aud (audience), exp (expiration time), iat (issued at), and nbf (not before). You can also add any custom claims your application needs. Use the "Add Standard Claims" helper to quickly add these common fields.

What is the "none" algorithm and when should I use it?

"none" produces an unsigned JWT — the signature section is empty. This should NEVER be used in production environments as it provides no integrity protection. It may be useful for testing parsers or generating tokens for systems that do not verify signatures, but always treat it as insecure.

How does the Standard Claims Helper work?

The Standard Claims Helper lets you quickly add common JWT registered claims to your payload. Fill in the Subject (sub), Issuer (iss), and/or Audience (aud) fields and choose an expiry window. The tool automatically sets iat (issued at) to the current Unix timestamp and calculates exp (expiration) from the selected window. Clicking "Apply to Payload" merges these into your JSON.

What does the token structure breakdown at the bottom show?

A JWT has three parts separated by dots: Header (algorithm and token type), Payload (claims), and Signature. The breakdown displays each base64url-encoded part color-coded so you can visually identify the structure of your generated token. This is useful for learning JWT internals or comparing tokens side by side.

Why is my generated token different every time even with the same inputs?

HMAC-based signatures are deterministic — if the header, payload, and secret are identical the output will always be the same. If you see a different token, check whether the iat (issued at) claim is being auto-updated to the current timestamp, which would change the payload and therefore the signature.

Can I verify a JWT with this tool?

This tool is designed for generating and signing tokens. To decode and inspect an existing JWT, use the JWT Decoder tool. Cryptographic signature verification (confirming the token was signed by a specific secret) is not currently implemented in this generator — use a dedicated library or the JWT Decoder for verification.

What happens if I enter invalid JSON in the payload field?

The tool will display a red error message below the textarea and will not generate a token until the JSON is valid. Make sure all keys and string values are wrapped in double quotes, and that the overall structure is a valid JSON object. The "Load Sample" button restores a known-good example payload.

How long should my secret key be?

For HS256, the key should be at least 32 bytes (256 bits) — matching the hash output length. For HS384 use at least 48 bytes, and for HS512 at least 64 bytes. Using a shorter key is technically allowed but reduces security. Use the Password Generator tool to create a cryptographically random secret of the right length.

Share ToolsZone

Help others discover these free tools!

Share this page

JWT Generator | Create & Sign Tokens Online