Create and sign a JWT in your browser
The JWT Generator builds a JSON Web Token from claims you choose and signs it with the Web Crypto API built into your browser. Pick an algorithm — HS256/384/512 with a shared secret, RS256/384/512 or PS256/384/512 with an RSA key, ES256/384/512 with an elliptic-curve key, or EdDSA with Ed25519 — fill in the issuer, subject, audience and times, add any custom claims as JSON, and the signed token appears immediately, colour-coded by part and already verified.
It is made for developers testing APIs, writing integration tests, reproducing an auth bug or learning how JWTs work. You can paste an existing test key (PEM or JWK) or generate a fresh key pair and export the public half as PEM, JWK or a JWKS document ready for a test identity provider.
Because tokens and keys are credentials, nothing here touches a server: signing, key generation and verification all run on your device. Even so, keep production secrets out of every website — use throwaway test keys.
How to use the JWT Generator
- Choose the Algorithm. Leave Type as JWT and add a Key ID if your verifier selects keys by
kid. - For HS algorithms, type or generate a Secret and set its format (text, hex or Base64). For RS, PS, ES and EdDSA, paste a private key or press Generate key pair.
- Fill in the Claims: issuer, subject, audience (comma-separated for several), expiry with the +15 min to +30 days shortcuts, not-before, issued-at and a random JWT ID.
- Add custom claims such as
"role": "admin"directly in the Payload JSON. - Copy the Signed token, check the verification badge, and copy the public key or JWKS for the service that will verify it.
JWT Generator features
Every common JWS algorithm
HS256/384/512, RS256/384/512, PS256/384/512 (salt length equal to the hash, as RFC 7518 requires), ES256/384/512 with raw R‖S signatures, and EdDSA (Ed25519) where the browser supports it.
Flexible keys
Imports PKCS#8, PKCS#1 “RSA PRIVATE KEY”, SEC1 “EC PRIVATE KEY” and private JWKs or JWKS sets, and explains wrong key types, curve mismatches, public keys and encrypted PEM files.
Key pair export
Generates RSA (2048–4096 bits), P-256/384/521 or Ed25519 key pairs and exports the public key as SPKI PEM, JWK or JWKS, with an RFC 7638 thumbprint you can use as the kid.
Two-way claims editor
Date pickers and quick buttons write Unix timestamps into the payload JSON; editing the JSON updates the fields, and each time claim shows its value relative to now.
Checked against known answers
The page’s self-test reproduces jwt.io’s famous HS256 example and the RFC 7517 and RFC 8037 keys byte for byte.
What the generator actually signs
A JWS compact token is BASE64URL(header) . BASE64URL(payload) . BASE64URL(signature). The header here is {"alg":"…","typ":"JWT","kid":"…"} in that order, and the payload is your JSON re-serialised compactly with its key order kept. The signature is computed over the ASCII text of the first two parts joined by a dot, so changing any character invalidates it.
Worked example: algorithm HS256, secret your-256-bit-secret (text), payload {"sub":"1234567890","name":"John Doe","iat":1516239022} gives eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c — the same token every JWT library produces for these inputs. Paste it into the JWT Decoder with the same secret to see it verify.
Choosing an algorithm and key
| alg | Key | Signature | Use it when |
|---|---|---|---|
| HS256 / 384 / 512 | Shared secret, at least 32 / 48 / 64 random bytes | 32 / 48 / 64 bytes | The same service issues and verifies tokens |
| RS256 / 384 / 512 | RSA, 2048 bits or more | Key size (256 bytes at 2048 bits) | Maximum compatibility, e.g. OpenID Connect ID tokens |
| PS256 / 384 / 512 | RSA, 2048 bits or more | Key size, randomised | You want RSA with modern PSS padding |
| ES256 / 384 / 512 | EC P-256 / P-384 / P-521 | 64 / 96 / 132 bytes | Short tokens and small keys |
| EdDSA | Ed25519 | 64 bytes, deterministic | Fast, modern signing where verifiers support it |
Safe habits for test tokens
- Always set exp. A token without an expiry is valid until its key is rotated. Access tokens usually live 5–60 minutes.
- alg “none” is refused. An unsigned token can be forged by anyone; RFC 8725 tells verifiers to reject it, and this tool will not create one.
- Use random secrets. RFC 7518 requires an HMAC key at least as long as the hash. “Random secret” uses
crypto.getRandomValues; for other token formats use the Random String Generator. - Remember the payload is readable. Signing protects integrity, not secrecy — anyone can Base64-decode the claims, so never put passwords in them.
- Times are Unix seconds (UTC). Convert others with the Unix Timestamp Converter.
JWT Generator FAQ
How do I create a JWT online?
Choose an algorithm, enter a secret or generate a key pair, fill in the claims and copy the signed token. This JWT generator signs in your browser, so the token is ready the moment you stop typing and is verified straight away.
Is it safe to generate JWTs on a website?
This page never sends your secret, key or token anywhere — everything uses your browser’s Web Crypto API. The risk is the habit: a real production key pasted into any web page could be captured by a browser extension or a screen share. Use test keys here and keep production keys in a secrets manager.
Why does my ES256 token have a different signature every time?
ECDSA and RSA-PSS add randomness to each signature, so signing the same claims twice gives two different, equally valid tokens. HS, RS (PKCS#1 v1.5) and EdDSA signatures are deterministic.
What key formats can I paste?
PEM private keys in PKCS#8 (“BEGIN PRIVATE KEY”), PKCS#1 (“BEGIN RSA PRIVATE KEY”) or SEC1 (“BEGIN EC PRIVATE KEY”) form, or a private JWK or JWKS. Passphrase-protected and OpenSSH keys must be converted first; the error message gives the command.
How do I verify the token in my API?
Give your API the public key — the PEM, JWK or JWKS shown under the private key — or the shared secret for HS algorithms. Configure it to accept only the algorithm you chose and to check exp, iss and aud.
Can I create a token with alg “none”?
No. Unsigned tokens have caused real authentication bypasses, so the option is listed but disabled. If you need to test that your server rejects them, build one by hand: Base64URL-encode {"alg":"none"} and the payload and leave the signature empty.