JWT generator for testing
Build and sign a test JWT with HS256, HS384 or HS512 from a JSON payload and a secret. Buttons set iat and exp. Signed in your browser with Web Crypto.
For test tokens only. A token signed here is as trustworthy as the secret you type, and a real signing secret should never be pasted into a web page, this one included.
The claims of the token, as a JSON object.
Used in your browser to sign the token. It is not sent anywhere.
The signed token appears here.Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the JWT generator for testing
- Choose HS256, HS384 or HS512.
- Write the payload as a JSON object, and use the buttons to set iat and exp.
- Enter a test secret, as text or as Base64.
- Press Sign token and copy the result.
About this tool
When you build or test an API that takes JSON Web Tokens, you need tokens on demand: one that is valid, one that expired a minute ago, one with the wrong audience, one for a user with no rights. This tool builds them. You write the payload as JSON, give a secret, and it signs the token with HMAC and SHA-256, SHA-384 or SHA-512 using the Web Crypto API in your browser.
The header is always {"alg": "HS256", "typ": "JWT"} with the algorithm you chose. The buttons set iat to the current time and exp to an hour ahead or a minute in the past, so you can test that your service rejects expired tokens. An HMAC key should be at least as long as the hash output, 32 bytes for HS256, and the tool warns when yours is shorter.
This is for test tokens. Do not paste a production signing secret into any web page: whoever holds it can issue tokens for every user. The better use is the reverse: sign a token here with a throwaway secret, then confirm that your production service refuses it, along with the expired and the wrong-audience ones.
Sources
Questions
Write the claims you need as JSON, pick an HMAC algorithm and sign with a secret your test environment is configured to accept. This tool does that in the browser. For tests in code, sign tokens with your JWT library so the test and the service share one configuration.
At least 256 bits, which is 32 random bytes. RFC 7518 requires a key at least as long as the hash output. A short or human-chosen secret can be found by offline guessing from a single captured token.
No. This tool signs with HMAC only, which is enough to test claim handling and expiry. Tokens for RSA or elliptic curve verification need a private key, and those are best made with your library or your identity provider’s test tenant.
iat is when the token was issued and exp is when it stops being valid. Both are seconds since 1 January 1970 UTC. A service must reject a token at or after exp.