About the JWT Generator tool
JSON Web Tokens carry identity and permission claims between services, and while testing an API you often need a token with a specific subject, role or expiry time. Waiting for a login flow or writing a throwaway script just to mint one slows you down. This JWT generator builds and signs a token directly in your browser so you can paste it into Postman, curl or your frontend straight away.
Edit the header and payload as JSON, use the quick buttons to set iat to the current time or push exp one hour, one day or seven days into the future, then choose an algorithm. HS256, HS384 and HS512 sign with a shared secret using HMAC. RS256/384/512, PS256/384/512 and ES256/384/512 sign with a PKCS#8 private key that you paste in, or with a fresh key pair generated on the spot, and the matching public key is shown so your server can verify the token.
All signing uses the browser’s built-in Web Crypto API, so secrets and keys stay on your device. The finished token is colour-coded into header, payload and signature, which makes it easy to see what each part contains.
How to use JWT Generator
- Pick an algorithm from the “Algorithm” list, for example HS256 for a shared secret or RS256 for an RSA key.
- Edit the “Header (JSON)” and “Payload (JSON)” boxes; use “iat = now” and the “exp +1h / +1d / +7d” buttons to set timestamps.
- For HS algorithms type the “Secret” (tick “Secret is Base64 encoded” if needed); for RS, PS or ES paste a PKCS#8 key or click “Generate key pair”.
- The “Signed JWT” panel updates automatically as you type.
- Click “Copy token” and use it as a Bearer token in your API client.
Features
12 signing algorithms
HMAC (HS256/384/512), RSA PKCS#1 v1.5 (RS*), RSA-PSS (PS*) and ECDSA (ES256/384/512) are all supported through Web Crypto.
Timestamp helpers
One click sets iat to now or exp to one hour, one day or seven days ahead, in Unix seconds as the JWT spec expects.
In-browser key pairs
Generate an RSA 2048-bit or EC P-256/P-384/P-521 key pair and get both PEM keys for testing.
Colour-coded output
Header, payload and signature segments are highlighted so you can tell them apart at a glance.
Helpful validation
Invalid JSON, PKCS#1 keys and short HMAC secrets are flagged with clear messages.
When to use it
- Mint a token with an admin role claim to test protected API routes locally.
- Create an already-expired token to check that your backend rejects it correctly.
- Produce RS256 test tokens and a public key for a new JWKS-based verifier.
- Generate sample tokens for API documentation or integration tests.
- Reproduce a customer’s token claims when debugging an authorisation bug.
Frequently asked questions
Is it safe to generate JWTs in the browser?
Signing happens locally with the Web Crypto API and nothing is sent to a server. Even so, use test secrets and keys here rather than production signing keys.
What key format do RS256 and ES256 need?
An unencrypted PKCS#8 PEM that starts with “-----BEGIN PRIVATE KEY-----”. Convert older PKCS#1 or SEC1 keys with: openssl pkcs8 -topk8 -nocrypt -in key.pem -out key-pkcs8.pem.
Is the JWT payload encrypted?
No. A signed JWT is only Base64URL-encoded, so anyone holding it can read the claims. The signature proves it was not modified; it does not hide the content.
What units do iat and exp use?
Both are NumericDate values: whole seconds since 1 January 1970 UTC, not milliseconds.
How long should an HS256 secret be?
RFC 7518 requires a key at least as long as the hash output, so 32 bytes for HS256, 48 for HS384 and 64 for HS512. The tool warns you when a secret is shorter.