JWT Generator

Build a signed HS256 JSON Web Token: edit the payload, add expiry, sign with your secret. Signing uses the Web Crypto API and never leaves your browser.

Colours: header . payload . signature. Paste this into the JWT decoder or into jwt.io (with the same secret) to verify it.

How a JWT is built

A JSON Web Token is three Base64url-encoded parts joined by dots: header.payload.signature. The header names the algorithm, the payload holds your claims, and the signature is a keyed hash of the first two parts. For HS256 that hash is HMAC-SHA256 computed with your secret. Change a single character of the header or payload and the signature no longer matches, which is exactly how a verifier detects tampering.

Signing proves two things

A valid signature tells the verifier the token was not altered in transit and was created by someone who holds the secret. What it does not do is hide anything. The payload is only encoded, so treat every claim as public. This is the single most common JWT mistake: putting a password, a session secret or personal data in the payload because it "looks" scrambled. It is not - the JWT decoder or a line of Base64 will reveal it instantly.

Timestamps and expiry

Two claims control a token's lifetime. iat records when it was issued and exp when it expires, both in Unix seconds. The quick-add buttons above fill these for you. Give access tokens a short exp - an hour is typical - so a stolen token is useless within minutes rather than forever. To read a raw exp back into a date, the Unix timestamp converter does the epoch maths, and the JSON formatter tidies a payload before you sign it.

Frequently asked questions

What does signing a JWT actually prove?
The signature is an HMAC (for HS256) of the header and payload made with your secret. Anyone holding the same secret can recompute it and confirm the token was not altered and was issued by someone who knew the secret. It proves integrity and authenticity, not confidentiality: the payload is still readable by anyone.
What is the difference between HS256 and RS256?
HS256 uses one shared secret for both signing and verifying (symmetric HMAC-SHA256). RS256 uses a private key to sign and a matching public key to verify (asymmetric RSA). HS256 is simpler and used here; RS256 suits systems where verifiers should not be able to mint tokens, since they only get the public key.
Is it safe to put data in a JWT payload?
Only non-secret data. A standard JWT payload is Base64url-encoded, not encrypted, so anyone with the token can read every claim. Never put passwords, API keys, card numbers or personal data you would not print in a log. Signing protects against tampering, not against reading.
What are iat and exp?
They are standard timestamp claims measured in Unix seconds. iat is when the token was issued and exp is when it stops being valid. Add exp so tokens cannot be replayed forever; a short lifetime like one hour is common for access tokens.
Can I trust a token generated here?
This tool signs tokens for testing and learning, entirely in your browser using the Web Crypto API. The secret never leaves the page. To confirm a token is well formed you can paste it into the JWT decoder or into jwt.io, which will verify the signature if you give it the same secret.