About the JWT Generator
The JWT Generator creates a signed JSON Web Token from a header and payload you write and a secret key you choose. It is meant for developers testing authentication code, mocking an identity provider, or learning how JWT signatures are built.
How it works
The header text and payload text are each encoded as UTF-8 and then as Base64URL (standard Base64 with + and / replaced by - and _, and the = padding removed). They are joined with a dot to form the signing input.
That string is signed with HMAC-SHA256 using your secret key through the browser's Web Crypto API, and the signature is Base64URL-encoded and appended after a second dot. The signature is always HMAC-SHA256, so the header's alg should be HS256. The text you type is encoded exactly as written, including any spaces, so the tool does not reformat or validate your JSON.
How to use
- 1
Edit the Header (JSON) box; keep "alg":"HS256".
- 2
Write your claims in the Payload (JSON) box.
- 3
Enter the Secret key your application uses to verify tokens.
- 4
Click Generate JWT, then copy the token from the box below.
Worked examples
The default example
Clicking Generate JWT without changing anything.
This matches the widely used sample token, which is a handy check that signing works as expected.
An admin test token with an expiry
Testing an admin-only endpoint locally.
exp 1767225600 is January 1, 2026 00:00:00 UTC, so a server checking expiry will reject this token after that moment.
Frequently asked questions
Should I use this to generate production tokens?+
No. It is meant for testing and learning. Production tokens should be issued by your server or identity provider, with the signing key kept out of browsers.
What's the difference between the header, payload and signature?+
The header names the algorithm and token type, the payload holds the claims, and the signature is an HMAC of the first two parts that proves they have not been changed.
Which signing algorithms are supported?+
Only HS256 (HMAC with SHA-256). Keep "alg":"HS256" in the header so the token describes itself correctly.
Why does my server say the signature is invalid?+
Check that the secret matches exactly, including case and trailing spaces, that the server expects HS256, and that it does not expect the secret to be Base64-decoded first.
Does the token expire automatically?+
Only if your payload includes an exp claim and the receiving server checks it. The generator does not add any claims for you.