Developer Tools
JWT Generator for HS256, HS384 and HS512
Create a signed JSON Web Token from a JSON payload and secret with HS256, HS384 or HS512. Adds iat and exp automatically, supports kid and checks secret length.
How to use JWT Generator for HS256, HS384 and HS512
Write the payload as a JSON object, choose the algorithm and enter the secret. The signed token appears as you type, with the final header and payload, the expiry time and a warning if the secret is shorter than the algorithm needs.
- Write the payloadEnter a JSON object with claims such as sub, name and role; arrays and plain values are rejected.
- Set algorithm and secretChoose HS256, HS384 or HS512 and enter the secret as text, Base64/Base64URL or hex; spaces are kept as typed.
- Set expiry and copyEnter Expires in with minutes, hours or days, add an optional kid, keep iat ticked, then copy the token.
How the token is built
The header, holding alg, typ JWT and kid if you give one, and the payload are serialised as JSON, encoded as UTF-8 and Base64URL, and joined with a dot. An HMAC of that string with the chosen SHA-2 hash becomes the third segment, giving header.payload.signature. iat is set to the current Unix time in seconds unless the payload already has one, and exp is the current time plus your expiry setting, so the default of 60 minutes adds 3,600 seconds. An exp already in the payload is replaced, and a note tells you so.
Secret length and safety
RFC 7518 requires an HMAC key at least as long as the hash output: 32 bytes for HS256, 48 for HS384 and 64 for HS512. The sample secret your-256-bit-secret is only 19 bytes, so a warning appears; use a long random secret in production. If your secret was issued as Base64 or hex, set Secret format to match, or the signature will not verify elsewhere. Signing uses the browser's Web Crypto API and the secret is not uploaded, but it is still wise to keep real production keys off shared computers.
Accuracy and data handling
Validate the result with your project's own tests and runtime rules before using it in production. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
Can it create RS256 or ES256 tokens?
No, it signs with HMAC only (HS256, HS384 and HS512). Asymmetric algorithms need a private key, which should stay out of web pages and be used through your own server-side library.
How can I check the token I generated?
Paste it into the JWT decoder with the same secret and secret format. The signature should show as Valid and the payload should match what you entered.
Why is the token different every time?
With Add issued-at time (iat) ticked, the timestamp changes every second, so the payload and signature change too. Untick iat and leave Expires in blank to get the same token for the same input.
More Developer Tools
Related toolsRun XPath queries on XML or HTML and list every matching node
Preview the next runs of a cron expression with a plain-English summary
Convert Linux file permissions between 755 and rwxr-xr-x, with chmod commands
Validate UUIDs, detect the version and decode v1, v6 and v7 timestamps
Read the timestamp in a ULID, validate it and convert it to or from a UUID
See every JWT claim explained, with readable times and expiry status