🏷 JWT Generator
Mint signed HS256, HS384, or HS512 test tokens with the WebCrypto API on this page, so the secret you type never reaches a server.
Last updated: November 8, 2026 · By the BoltQuickTools team
Minting a signed test token for your API
Testing an endpoint that requires a JWT usually means logging in through the real flow just to get a token, and even then you cannot easily try an expired one or a different role. This page signs a token with whatever claims you choose, using HMAC and a shared secret, so you can paste it into curl, Postman or a test.
Building a token
- Edit the JSON in Header and Payload (Claims). The preset buttons user session, api access, refresh token and minimal replace the payload with a common shape.
- Enter the key in Secret (HMAC key) and choose HS256, HS384 or HS512 under Algorithm.
- Optionally set Auto-set iat + exp to +1 hour, +1 day, +1 week or +30 days. Leave it on Manual to keep your own timestamps.
- Click Generate Token, then click the Token box to copy it. There is no copied message.
Changing a preset, the algorithm or the secret does not update the token by itself. Click Generate Token again each time.
Exact output for known inputs
HMAC is deterministic, so these inputs always produce these tokens. With Manual timing, HS256, the header {"alg":"HS256","typ":"JWT"}, the payload {"sub":"user_123"} and the secret test-secret-please-change:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzEyMyJ9.8DnRzwf4tV5pNKq3XQP66FBaHhf0WogkXymcSyLM67Y
Switch to HS512 and both the first and last segments change:
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzEyMyJ9.e-bxqwDeBEF65Um3yAt2LbeDnF6_2G7_YJ8GDsp7ciSnJKBNCkRG0qayxMKM_weSSPlor64u1IE7uw6fQmp9wA
A verifier configured with the same secret and algorithm should accept these, which makes them handy for checking that a library is set up correctly. Libraries that enforce the minimum key length described below may refuse this 25-byte secret.
Behaviour worth checking before you rely on a token
- The sample payload is already expired. Its
expof1716003600falls in May 2024, so an API that checks expiry rejects the starter token. Pick an Auto-set iat + exp value to get a live one. - Auto-set rewrites your payload. Any choice except Manual overwrites
iatandexpand saves them back into the box. - Preset times are fixed at page load. Presets capture the clock once, so if the tab has been open for hours their
expis already partly used up. The refresh token preset also repeats the samejtiuntil you reload. - The Algorithm dropdown wins. It overwrites
algin the signed header, but the Header box keeps showing what you typed. A missingtypis filled in asJWT. - The secret is read as UTF-8 text. If your server base64-decodes its key first, paste the decoded value here or the signatures will not match. A decoded key that is not valid text cannot be entered at all. An empty secret produces an error instead of a token.
- Short secrets are accepted without warning. The default
your-256-bit-secretis only 19 bytes despite its name. RFC 7518 asks for a key at least as long as the hash output, so 32 bytes for HS256. - Timestamps are in seconds. Nothing validates them, so a 13-digit millisecond value creates a token that lasts for thousands of years.
- Very large payloads can fail. The encoder passes every byte as a separate function argument, so a payload of around 125 KB can stop with
Error: Maximum call stack size exceeded. The exact limit depends on the browser.
RS256, ES256 and other asymmetric algorithms are not available. To inspect the result, paste it into the JWT decoder. To compute a signature for other kinds of message, use the HMAC generator. Passwords need a different approach entirely, which the password hashing guide explains.
Questions about signing here
Why does my server say the signature is invalid?
Check three things: the algorithm matches, the secret has no stray whitespace or newline, and the server is not base64-decoding its key. The signature covers the exact encoded header and payload, so re-serialising the JSON elsewhere will not match.
Can I use a production secret on this page?
Signing runs through crypto.subtle in your browser, and the page's own script sends nothing over the network. Even so, the page also loads analytics, plus ads if you accept them, and a production signing key should not be typed into any web page. Use a throwaway secret for testing.
Can I test how my API handles an expired token?
Yes. Leave the timing on Manual and set exp to a past Unix time. The sample payload already does this.