01What is JWT Generator?
You need a token to hit a protected endpoint, and your auth server is not running yet. JWT Generator signs a JSON Web Token in your browser using one of the three HMAC algorithms named in RFC 7518: HS256 (HMAC with SHA-256), HS384 and HS512. The signing runs through the browser's Web Crypto API. The header is fixed to {"alg": <your choice>, "typ": "JWT"}. You write the payload as JSON in the editor, and the token is re-signed on every change. RFC 7519 says the claims set must be a JSON object, so the tool checks that. An array, a string or null gets an error instead of a token that libraries would refuse. Broken JSON gets "Invalid JSON payload". Quick buttons insert the registered claims iss, sub, aud, exp, iat, nbf and jti. jti gets a random UUID. The Quick Expiration buttons set iat to now and exp to 1 hour, 24 hours, 7 days, 30 days or 1 year ahead. The secret is used as raw UTF-8 bytes. Most server libraries treat a plain string secret the same way, which is why a token from here should verify there with the same string. We checked the HS256 output against Node's built-in createHmac and got the same signature. One detail trips people up. The payload is encoded exactly as you typed it, whitespace and all. So {"sub":"42"} and {"sub": "42"} produce different payload segments and different signatures. Both are valid. They are just not identical. A worked example: pick HS256, enter {"sub":"42"} and the secret "secret". The tool produces a token starting eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiJ9 and ending with a 43-character signature, 79CVgMIG... Switch to HS512 and the first two segments barely change, but the signature grows to 86 characters, because SHA-512 gives 64 bytes instead of 32. The token is shown colour-coded by part, and you can copy the header, payload and signature separately or all at once. Limits: there is no RS256, ES256 or other public-key signing. The none algorithm is deliberately not offered, because an API should never accept unsigned tokens. Nothing you type is sent to a server, though you should still use test secrets here, not production ones.
Backend developers testing HMAC-signed JWT auth locally, and QA engineers who need tokens with specific claims or expiry times to probe API authorization rules. The tool runs entirely in your browser, so your data never leaves your device.
02How to use JWT Generator
- Pick HS256, HS384 or HS512 with the algorithm buttons.
- Edit the JSON in the Payload editor, or click iss, sub, exp, iat, nbf, aud or jti to insert a registered claim.
- Use a Quick Expiration button (1 hour up to 1 year) to set iat to now and exp ahead.
- Type the Secret Key your API uses to verify tokens. Use Show to check what you typed.
- Copy the token, or just its Header, Payload or Signature part, and send it as a Bearer token in your API test.
03Worked examples
- Input:
Algorithm HS256, payload {"sub":"42"}, secret: secret - Result:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiJ9.79CVgMIG_JB921dVUeJDWNJubJojFodH3-XtC_1C408 - The first two parts are just base64url-encoded JSON, so anyone can read the claims; only the third part depends on the secret.
- Input:
Algorithm HS512, same payload and secret - Result:
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiJ9.OOnmim08R5KPn3wNhfsu5HW2EyBxHZKIDBHSjSRDrCOhWlmKZr9e10Ktf-JcrAjCDBi6c-wB5_5HlUnSd2KN1g - The payload segment is identical; the header now says HS512 and the signature is 64 bytes instead of 32, so it is twice as long.
- Input:
Algorithm HS256, payload {"sub": "42"} (with a space after the colon), secret: secret - Result:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiAiNDIifQ.FNZZYvQgW9q6aYXKz6fCv2uHvnwxtGTGW36EDjocvNM - The payload is encoded exactly as typed, so one extra space changes both the payload segment and the signature.
- Input:
Algorithm HS384, payload {"sub":"42"}, secret: secret - Result:
eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiJ9._XqjM_YHAu4CWMH7hzfxehwzIF-YR7dACRjxtIVmJX5xNtZlNRiNQT77cP9PWVPM - HS384 gives a 48-byte signature, which is 64 Base64URL characters.
- Input:
Payload [1,2] - Result:
Error: Payload must be a JSON object, for example {"sub": "123"} - Valid JSON is not enough: a JWT claims set has to be an object.
- Input:
Payload {"sub":"42"} with an empty secret - Result:
Error: Secret key is required
04Common use cases
- Creating a token to call a locally running API that checks HS256 signatures, before the real login flow exists
- Testing role checks by signing one token with role admin and another with role viewer, using the same secret
- Setting exp to a time in the past to confirm your middleware answers 401 instead of letting the request through
- Adding an nbf a few minutes ahead to see how your server handles a token that is not valid yet
- Checking that your backend rejects a token signed with HS512 when it expects only HS256
- Reproducing a bug report by rebuilding a token with the exact claims a user's session carried
05Tips
- exp, iat and nbf are seconds since the Unix epoch, not milliseconds. A value 1000 times too large is a common bug from Date.now().
- To test expiry handling, set exp to a time in the past and check that your API answers 401.
- For HS256, RFC 7518 asks for a key at least as long as the hash output, so use 32 or more random bytes. Short secrets can be brute-forced offline.
- Whitespace in the payload changes the signature. If you compare tokens byte for byte with another tool, minify the JSON first.
- Keep production secrets out of any browser tool. Mint test tokens with a separate test secret your staging API trusts.
06Related concepts
HMAC-SHA256, JWS, Bearer token, OAuth 2.0.
Frequently Asked Questions
What is JWT Generator?
JWT Generator is a free, browser-based developer tool on AIDToolStack. Create and sign JSON Web Tokens with custom claims, expiration, and HMAC algorithms It requires no installation or sign-up and works entirely in your browser.
Is JWT Generator free to use?
Yes. No sign-up, no fees and no usage cap.
Does JWT Generator store my data?
No. It runs in your browser; nothing is uploaded.