JWT

JWT Generator

Pick an algorithm, write your claims, and sign a new JWT — with a secret for HMAC or a private key for RSA/ECDSA. Runs entirely in your browser.

Algorithm
Payload (claims)
HMAC — shared secret
Signing happens entirely in your browser — nothing is sent anywhere. Still, treat a real secret or private key the same way you'd treat a password: use a throwaway value here unless you control this page's hosting yourself.
Generated JWT
Enter a JSON payload above to build a token.

Quick Learn

Building a JWT is the mirror image of verifying one: instead of checking a signature against a key, you compute a fresh signature with it. The header and payload are base64url-encoded and joined with a dot, and that string is signed to produce the third part — the exact process this tool automates for you, for both symmetric algorithms (HMAC, where the same secret signs and verifies) and asymmetric ones (RSA and ECDSA, where a private key signs and only the matching public key can verify).

This tool picks the header for you based on the algorithm you choose — you only write the payload, the claims that actually carry your data. Signing happens entirely client-side using your browser's Web Crypto API; nothing you type, including a secret or private key, is ever sent anywhere.

Best Practices

  • •Use a throwaway secret or key pair when experimenting — even though signing happens locally in your browser, it's a good habit never to type a real production credential into a general-purpose tool.
  • •For RSA and ECDSA, this tool needs the private key (not the public key) in PKCS#8 PEM format — the block starting with "-----BEGIN PRIVATE KEY-----". Older formats like "-----BEGIN RSA PRIVATE KEY-----" need converting first.
  • •Set exp thoughtfully: a payload with no exp claim produces a token that never expires by JWT's own rules, which is rarely what you want for a session or access token.
  • •Generate a token here, then paste it straight into the JWT Decoder or Verifier tool to confirm it decodes and verifies the way you expect — a quick round-trip catches most mistakes immediately.

More JWT Tools

See all JWT tools

Frequently Asked Questions

Is my secret or private key uploaded anywhere?

No. Signing runs entirely in your browser using the Web Crypto API — nothing you type, including a secret or private key, is ever sent to a server or stored anywhere.

Which algorithms can I sign with?

HS256, HS384, HS512 (HMAC with a shared secret), RS256, RS384, RS512 (RSA with a private key), and ES256, ES384, ES512 (ECDSA with a private key) — the same nine algorithms the JWT Verifier tool supports.

Why can't I edit the header directly?

The header is derived automatically from the algorithm you pick (alg and typ: "JWT") to avoid a mismatched header and signature — the most common way a hand-edited JWT ends up broken. The payload is where your actual claims go.

What format does the private key need to be in?

PKCS#8 PEM — the block starting with "-----BEGIN PRIVATE KEY-----". If you have an older format (like "-----BEGIN RSA PRIVATE KEY-----" or "-----BEGIN EC PRIVATE KEY-----"), convert it first, e.g.: openssl pkcs8 -topk8 -nocrypt -in key.pem -out key-pkcs8.pem

The payload I typed isn't producing a token — why?

The payload must be valid JSON and must be an object (not an array or a bare value) — that's the one structural rule JWT claims have to follow. Beyond that, any keys and values are allowed.

Want the engineering deep-dives behind tools like this one?