JWT Generator
Build a JSON Web Token and sign it with HS256, HS384 or HS512. The token is re-signed as you type, using the Web Crypto API in your browser.
The key is 19 bytes. RFC 7518 requires at least 32 bytes for HS256; short secrets can be brute-forced offline.
Claim helpers
iat: Thu, 18 Jan 2018 01:30:22 GMT
Signed token
Signing…
What this JWT generator is for
When you build or debug an API that uses JSON Web Tokens, you constantly need tokens with specific claims: an admin role, an expired exp, a different audience, a user ID that does not exist. Logging in through the real identity provider for each case is slow. This tool lets you write the header and payload as JSON and signs them with a shared secret, producing a token your backend will accept exactly as if your own auth server had issued it.
It signs with HMAC-SHA-256, -384 or -512 using the browser's Web Crypto API. Those are theHS256, HS384 and HS512 algorithms of RFC 7518, which most single-service APIs, test environments and frameworks such as Express with jsonwebtoken, Spring Security or Django REST framework SimpleJWT use by default.
How to use it
- Pick the Algorithm. Changing it also updates "alg" in the header.
- Type the Secret your API uses, or click Random secret to create a key of the recommended length. Tick Secret is Base64url-encoded if your server stores the key as Base64 and decodes it before use.
- Edit Payload (JSON claims). Use the claim helpers to set iat to now, add an expiry from 15 minutes to 30 days, remove exp, or add a random jti.
- The Signed token panel updates as you type. Errors in the JSON are shown under the editor instead of a token.
- Click Copy token and send it in an Authorization: Bearer <token> header, or click Verify in JWT Decoder to inspect it.
Worked example
With the default values — algorithm HS256, secret your-256-bit-secret, header and payload:
{ "alg": "HS256", "typ": "JWT" }
{ "sub": "1234567890", "name": "John Doe", "iat": 1516239022 }the tool produces this token:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 .eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ .SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
(shown on three lines here; the real token is one line). It is the well-known example token used in JWT documentation, which confirms the signature is computed the standard way. Note that the tool also warns that this 19-byte secret is shorter than the 32 bytes RFC 7518 requires for HS256.
What each part means
- Header — metadata about the token. alg is always set to the selected algorithm when signing; you can add fields such as kid (key ID) if your server picks keys by ID.
- Payload — the claims. Registered ones include sub (subject), iss (issuer), aud (audience), exp, nbf and iat (times in seconds since 1970, UTC) and jti (unique ID). Anything else, like role, is a custom claim.
- Signature — HMAC of base64url(header) + "." + base64url(payload) with your secret. Change one character of the payload and the signature no longer matches.
The token is encoded, not encrypted: anyone holding it can read the payload. Never put passwords or personal data in claims.
Limitations
- Only HMAC algorithms. RS256, ES256 and PS256 need a private key and are not supported.
- No encrypted tokens (JWE).
- Times use your computer's clock; if it is wrong, iat and exp will be too.
- This is a testing tool. Production tokens should be issued by your backend, with secrets kept in a secret manager.
Tips and common mistakes
- Milliseconds instead of seconds: exp must be in seconds. A 13-digit value is a bug that makes tokens valid for thousands of years.
- "invalid signature" on the server usually means the server decodes the secret from Base64 and you did not (or vice versa) — try the Base64url checkbox.
- Test expired tokens by setting exp to a time in the past and checking that your API returns 401.
- Paste a token you received into the JWT Decoder to read its claims and verify it, or hash data with HMAC in the Hash Generator.
Frequently Asked Questions
Are the tokens from this JWT generator really signed?
Yes. The signature is a real HMAC computed with the Web Crypto API (HS256, HS384 or HS512), so any standard library such as jsonwebtoken, jose or PyJWT will accept the token when given the same secret.
Is my secret sent to a server?
No. The header, payload and secret are processed only in your browser and no network request is made. Even so, use test secrets: you should not paste production signing keys into any website.
Does it support RS256 or ES256?
No. Only the HMAC algorithms HS256, HS384 and HS512 are supported. RS256 and ES256 sign with a private key, which this tool does not handle.
How long should an HS256 secret be?
RFC 7518 requires a key at least as long as the hash output: 32 bytes for HS256, 48 for HS384 and 64 for HS512. The tool warns when your secret is shorter, and Random secret creates one of the right length.
How do I set the expiry time?
Use the claim helpers under the payload: exp in 15 min, 1 hour, 24 hours, 7 days or 30 days set both iat (now) and exp as Unix timestamps in seconds. You can also edit the numbers directly in the JSON.
How can I check the generated token?
Click Verify in JWT Decoder. The token opens in the decoder through the URL fragment, which is not sent to the server, and you can enter the same secret there to verify the signature.
Related tools
- UUID GeneratorGenerate RFC 4122 compliant UUIDs (v1, v4, v5) in bulk. Export as JSON, CSV, or plain text.
- Lorem Ipsum GeneratorGenerate Lorem Ipsum placeholder text in paragraphs, sentences, or words with optional HTML output.
- QR Code GeneratorGenerate customizable QR codes for URLs, text, emails, WiFi, vCards, and phone numbers.
- QR Code ScannerScan QR codes with your camera or from an image file directly in the browser. Copy the result, open safe links and see the decoded content type.
- Regex TesterTest, debug, and visualize regular expressions against sample text in real time with match highlighting.
- SQL Formatter & BeautifierFormat and beautify SQL queries with proper indentation, keyword capitalization, and syntax highlighting.
Found a bug or a wrong result? Report it.