What is a JWT generator?
A JWT generator builds a JSON Web Token — a small, signed package that websites use to prove who you are. When you log in somewhere, the server often hands your browser a token, and the browser sends it back with every request. This tool makes such a token for you: type a subject and a name, set an issued-at time, enter a secret, and press the button. The result is a token in three parts, separated by dots.
The three parts each have a job. The header says how the token is signed — here it is always HS256, which means HMAC with SHA-256 — and that the token is a JWT. The payload carries the claims: the subject, the name, and the issued-at time. The signature is the proof: it is made from the first two parts plus your secret, so anyone holding the secret can check that the token has not been changed.
The default on this page is the classic example from the JWT specification. Its subject is 1234567890, its name is Ada Lovelace, and it was issued at 1516239022, which is 18 January 2018. With the default secret, the token is 160 characters long. Change any input — the name, the time, one letter of the secret — and the signature changes completely, because that is what a signature is for.
Everything runs in your browser. The signing uses CryptoJS, an open-source library released under the MIT licence, loaded from a copy stored on this site at /vendor/crypto-js.min.js, with a built-in fallback that gives the identical token. Your secret never leaves your device — it is never uploaded, stored, or sent anywhere.
How a JWT generator works
The generator starts by turning the header and the payload into JSON text. The header is {"alg": "HS256", "typ": "JWT"} and the payload is {"sub": "1234567890", "name": "Ada Lovelace", "iat": 1516239022} for the defaults. Both are then encoded with base64url, the web-safe cousin of base64: it uses a hyphen instead of a plus, an underscore instead of a slash, and it leaves off the padding equals signs.
Then comes the signature. The generator takes the encoded header, a dot, and the encoded payload, and runs HMAC-SHA256 over that string using your secret as the key. HMAC is a keyed hash: the same message signed with a different secret gives a completely different signature, and nobody can forge one without the secret. The 32-byte signature is base64url-encoded, and the three parts are joined with dots.
Because HS256 is deterministic, the same inputs always give the same token. The default inputs always produce the same 160-character token, and you can check that against any other correct JWT tool — they will agree, because the algorithm is standard. That determinism is also what makes the tool testable: a forged or broken implementation would give a different token.
The token is only as secure as the secret. Anyone who knows the secret can make tokens that a server will trust, and anyone who has a token can read its header and payload, because those parts are only encoded, not encrypted. Never paste a real production secret into any website, including this one — use a throwaway secret for learning and testing, and keep real secrets on your own server.
The inputs, and what each one means
The subject is the user the token is about. In real systems it is usually a user id from a database — a number like 1234567890, or a short string like 42. It is the one claim almost every token carries, because the server needs to know whose token it is looking at. Keep it short and free of spaces.
The name is a display claim — a human-readable name such as Ada Lovelace. It is there for convenience, so a reader of the token can see who it belongs to without looking anything up. Real tokens often carry more claims than this: a role such as admin, an expiry time, or an email address. This tool keeps the payload to three claims so the token stays easy to read and the signing stays easy to follow.
The issued-at time is a Unix timestamp: seconds since 1 January 1970. The default, 1516239022, is 18 January 2018. Servers use it to tell how old a token is, and they usually pair it with an expiry claim that this simple generator does not add. If you set the issued-at time to a current timestamp, the token looks fresh; if you set it years in the past, a strict server would reject it as stale.
The secret is the key that signs the token. It should be long and random in real use — a password generator makes good secrets, and a random string generator makes them in bulk. A short secret, like the word secret, lets anyone forge tokens, which is the same as having no signature at all. The default secret here, your-secret-key, is only an example.
A worked example: the classic token, step by step
Start with the defaults: subject 1234567890, name Ada Lovelace, issued at 1516239022, secret your-secret-key. The header encodes to eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9, and the payload to eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkFkYSBMb3ZlbGFjZSIsImlhdCI6MTUxNjIzOTAyMn0. Those two strings are the same on every correct tool, because base64url encoding is standard.
The signature is where the secret matters. HMAC-SHA256 over the header, a dot, and the payload, keyed with your-secret-key, gives rRpGb1K7gGQ4hvBWru80M20l8nlSeLWGsPkNh4deTAI. Join the three parts with dots and the full token is 160 characters long. Paste it into a JWT decoder and you will see the header and payload printed back as JSON.
Now change one thing: the subject to 42, the name to Bob, the issued at to 1700000000, and the secret to test-secret. The token becomes a different 137-character string, with a different signature. The header part stays the same, because the header did not change, but the payload and the signature both change. That is the point of signing: any change to the claims breaks the old signature.
Try a third set: subject 7, name Priya Sharma, issued at 1720000000, secret my-app-secret-123. The token is 148 characters long. The length moves with the claims: a longer name makes a longer payload, and a longer payload makes a longer token. The signature is always 43 characters, because a SHA-256 digest is always 32 bytes.
Who generates JWTs, and why
Developers generate tokens while building login systems. A token is the thing that proves a user is logged in, and making one by hand is the fastest way to test whether the login works: generate a token, send it to the server, and see whether the server accepts it. If it does, the signing and the claims are right.
Testers use a generator to check edge cases. What happens when the subject is missing, when the issued-at time is in the future, or when the name contains characters from another script? A generator answers those questions in seconds, without writing code. A hash generator is the companion for checking the digests underneath, and a base64 encoder decoder explains the encoding the token uses.
Learners use it to understand how authentication works on the modern web. The idea that a login can be a self-contained, signed package — rather than a session stored on a server — is unfamiliar at first, and building a real token makes it concrete: a header, some claims, and a signature, each with a job to do. Reading the token back in a decoder closes the loop.
Support teams use a generator to reproduce a user's problem. If a user reports that their session keeps ending, the team can generate a token with the same claims and see what the server does with it. The generator is a small tool, but it sits at the centre of the most common login system on the web, so it gets used every day by people who build and fix those systems.
JWT generator vs JWT decoder
The generator and the decoder are two halves of the same idea. The generator builds a token from claims and a secret. The decoder reads a token back into its header and payload. This page is the generator; the JWT decoder is the other half, and the two work together — generate a token here, paste it there, and check that the claims came back exactly as you set them.
The honest difference is the secret. The decoder needs no secret, because decoding is just reversing the base64url encoding. The generator needs one, because signing is a keyed operation. That is also why the generator carries a warning the decoder does not: your secret is the thing that makes the token trustworthy, so it must stay on your own machine and never be a real production secret on a website.
For the rest of the toolkit, the companions are close. A JSON formatter formats the decoded header and payload for reading, a password generator makes the strong secrets that signing keys should be drawn from, and a hash generator shows the SHA-256 digest inside the HMAC signature.
If you need to verify a token — to check that its signature is genuine — do it on your server, with the key that signed it, using a library for your language. Never verify by pasting the key into a web page. The generator's job is to make tokens for learning and testing; the server's job is to decide whether to trust them.
Common JWT mistakes
The first mistake is using a real production secret here, or on any website. A token is only as secure as the secret that signed it, and a secret typed into a web page is a secret you no longer control. Use a throwaway secret for testing, and keep production secrets in your server's environment, where no browser ever sees them.
Second: putting sensitive data in the payload. Passwords, secrets, full addresses, and payment details do not belong in a token, because anyone who sees the token can read the payload — it is only encoded, not encrypted. Keep tokens to identifiers and roles, and fetch the sensitive data from the server when it is needed.
Third: a weak secret. Short secrets such as secret, password, or your-app-name fall to guessing in minutes, and a guessed secret lets anyone forge tokens that your server will trust. A signing secret should be at least 32 random characters — generated, not invented — and different for every environment, so a leaked test secret cannot sign production tokens.
Fourth: forgetting expiry. A token without an expiry never stops working, so a stolen token works forever. Real tokens carry an expiry claim and are short-lived, with a refresh mechanism to get a new one. This simple generator does not add an expiry claim, so tokens made here are for learning and testing, not for a live login system.
How to use this JWT generator
Using this JWT generator is simple. Enter a subject — a user id such as 1234567890. Enter a name, such as Ada Lovelace. Set the issued-at time, or leave the default. Enter a secret, and remember: use a throwaway secret, never a real production secret. Press Generate JWT, and the token appears in the box below, with its algorithm, its part count, and its length shown above it.
To check the result, copy the token and paste it into a JWT decoder. The header should say HS256, the payload should show exactly the subject, name, and issued-at time you entered, and the token should have 3 parts. If any of those differ, one of the inputs was not what you thought it was.
To see the signature at work, change one letter of the secret and generate again. The header and payload parts stay the same, but the signature changes completely — that is the signature doing its job. Change the secret back, and the original token returns, because HS256 is deterministic.
Everything runs in your browser. The signing library is stored on this site, the page makes no network requests for it, and your secret never leaves your device. Closing the page removes what you typed. Use the tool to learn and to test, and keep your real secrets on your own server.