JWT Generator
Create a signed JWT for development and testing.
How it works
Edit the JSON header and payload, enter a secret key, pick HS256, HS384 or HS512 and press Sign Token. The signed token appears for you to copy.
Use test secrets only
Use this for development and learning. Never paste a real production signing secret into any website.
How to use it
- Edit the Header and Payload JSON.
- Enter a Secret key and choose the Algorithm.
- Press Sign Token and copy the result.
Common use cases
- Testing API authentication locally.
- Learning how JWTs are structured.
- Creating tokens with specific claims for tests.
A token you can verify yourself
With the algorithm set to HS256, the secret test-secret and this payload, the tool produces a token whose three parts you can reproduce with any HMAC library:
Header: {"alg":"HS256","typ":"JWT"}
Payload: {"sub":"1234","name":"Test User","role":"admin","iat":1700000000,"exp":1700003600}
header.payload: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0IiwibmFtZSI6IlRlc3QgVXNlciIsInJvbGUiOiJhZG1pbiIsImlhdCI6MTcwMDAwMDAwMCwiZXhwIjoxNzAwMDAzNjAwfQ
signature: Tr8upnoMkts_kNZibZcg1HCBRd0b1-Kcq4QGcpo-Ups
Here iat is 1700000000, which is 2023-11-14 22:13:20 UTC, and exp is exactly one hour later. The signature is HMAC-SHA256 of the text header.payload using the secret, written in Base64URL without padding.
Details of the signing step
The tool always sets alg to the algorithm you pick in the dropdown and typ to JWT, overwriting whatever you typed in the header box, so the header and the signature can never disagree. Key order and spacing in your JSON are normalised by re-serialising, which means the encoded parts may differ from a token produced by another library even when the claims are the same. Both are valid; a verifier only checks the signature over the exact string it receives.
Timestamps such as iat, nbf and exp are plain numbers in seconds, not milliseconds. If you paste a value from JavaScript’s Date.now(), divide by 1000, or your token will appear to expire thousands of years in the future.
Limits to be aware of
Only HMAC algorithms are available. There is no RS256, ES256 or none, so you cannot generate tokens for services that expect an asymmetric signature. The secret is used exactly as typed (as UTF-8 text), not Base64-decoded first; if your library expects a Base64-encoded secret, decode it before pasting. Short secrets work, but real HS256 secrets should be at least 32 random bytes, which matters when you move from a test token to production.
Using the token in a test
Paste the token into an Authorization: Bearer header of the REST API tester, or into your test fixtures. To test expiry handling, generate a second token with an exp in the past and confirm your API answers 401. To test authorisation, vary a claim such as role and check that each value gets the access you expect. The Sign Token button also colours the header, payload and signature so you can see where each part begins.
Frequently asked questions
Which algorithms are supported?
HS256, HS384 and HS512.
Can I decode a token?
Yes, use the JWT Decoder.
Is it safe to use my real secret?
No. Use test secrets only.
Is my data uploaded?
No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.
Why does my token not verify in another library?
Check that the secret matches byte for byte, that the library is configured for the same HS algorithm, and that it does not Base64-decode the secret first.
Can I create an unsigned or RS256 token?
No. The generator signs with HS256, HS384 or HS512 only.