JWT Generator
Build a signed JWT to test an API, a login flow or a token check. Type the claims, choose an algorithm, use your test secret or let the page create a test key pair, and copy the token. For testing only.
About JWT Generator
Testing code that accepts JSON Web Tokens is awkward when the only way to get a token is to log in through a real identity provider. JWT Generator lets you make your own signed tokens with exactly the claims you want, so you can try an expired token, a missing role or a wrong audience in seconds.
Choosing an algorithm
- HS256, HS384, HS512 sign with a shared secret. Your service must be configured with the same secret. Use the Random secret button to get a key of the length RFC 7518 recommends (32, 48 or 64 bytes), shown as Base64url.
- RS256 uses a 2048-bit RSA key pair, and ES256 uses an elliptic-curve P-256 key pair. The page creates a fresh pair in your browser. Give the public key (PEM, or the JWKS block for libraries that load keys from a JSON Web Key Set) to the service under test. The private key stays in this tab and disappears when you close it.
Worked example
Pick HS256 and type the secret your-256-bit-secret as plain text. Replace the payload with {"sub":"1234567890","name":"John Doe","iat":1516239022} and press Create token. You get the same token that appears as the sample on jwt.io, ending in SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c. Matching that string confirms signing works as libraries expect.
To test expiry handling, choose “Already expired (1 hour ago)” as the lifetime and press Set iat and exp. The exp claim is set one hour in the past, so a correct server should reject the token.
Good habits
- Treat every secret typed into a web page as a test secret. This page sends nothing anywhere, but secrets spread through copy and paste.
- Do not test with
alg: none. This page never creates unsigned tokens, because accepting them is a classic security hole. - Add
audandissclaims that match your service’s settings, otherwise a well-configured library will refuse the token for that reason rather than the one you are testing. - Read your new token back with the JWT Decoder to check the header and the dates.
How to use JWT Generator
- Choose the algorithm: HS256/HS384/HS512 with a shared secret, or RS256/ES256 with a key pair made here.
- Edit the payload JSON and press "Set iat and exp" to add an issue time and expiry.
- Press Create token, copy it, and give the public key or secret to the system you are testing.
Privacy: how it works
The token is signed in your browser with the Web Crypto API. Secrets, keys and claims are not sent, stored or logged.
Frequently asked questions
Can I use these tokens in production?
No. They are meant for development and tests. Production tokens should be issued by your own server, with keys that never leave it.
Where does the RS256 or ES256 key come from?
Your browser creates a new key pair with the Web Crypto API when you press the button. It exists only in this page and is gone when you close it. Copy the public key (PEM or JWKS) into the service you are testing.
Why does it warn that my secret is short?
RFC 7518 says an HMAC key should be at least as long as the hash: 32 bytes for HS256, 48 for HS384 and 64 for HS512. Some libraries refuse shorter secrets. The Random secret button makes one of the right length.