JWT Generator & Verifier

Your data never leaves your browser

Sign and verify JSON Web Tokens with HS256, HS384, or HS512. Uses the browser's Web Crypto API, your secret never leaves the page.

Algorithm:
Payload (JSON)
Ctrl+EnterRunCtrl+KClearHS256/384/512 via Web Crypto API. Nothing leaves your browser.

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/jwt-generator

JWT structure

A JWT consists of three base64url-encoded parts separated by dots:

HEADER

Declares the token type (JWT) and signing algorithm (e.g. HS256). Base64url-encoded JSON.

PAYLOAD

Claims about the subject, user ID, name, expiry (exp), issued-at (iat), etc. Base64url-encoded JSON.

SIGNATURE

HMAC of header + "." + payload using your secret. Proves the token was not tampered with.

HS256 vs HS384 vs HS512

AlgorithmHashSignature sizeMin. secret lengthRecommendation
HS256SHA-25643 chars32 bytes recommendedMost common, sufficient for most use cases
HS384SHA-38464 chars48 bytes recommendedHigher security margin, rare in practice
HS512SHA-51286 chars64 bytes recommendedHighest security, larger tokens, fast on 64-bit

When to use JWTs

Frequently Asked Questions

Is it safe to generate JWTs in the browser?

For testing and development, yes. This tool uses the browser's native Web Crypto API, your secret is never sent over the network. For production systems, generate tokens server-side where the secret is protected by environment variables and never exposed to clients. Browser-generated tokens should only be used for testing.

What is the difference between HS256 and RS256?

HS256 uses a symmetric secret (same key to sign and verify). RS256 uses an asymmetric RSA key pair, the private key signs the token, and the public key verifies it. RS256 is better when multiple services need to verify tokens without sharing a secret. This tool supports HS* algorithms only.

What claims should every JWT have?

At minimum: iss (issuer), sub (subject/user ID), iat (issued-at timestamp), and exp (expiry timestamp). The exp claim is critical, without it, a stolen token is valid forever. A typical expiry is 15 minutes for access tokens and 7–30 days for refresh tokens.

Why is my JWT verification failing?

Common causes: wrong secret (it must be identical to the one used to sign), algorithm mismatch (the verifier must use the same algorithm as the signer), the token is expired, or the token was URL-decoded (plus instead of dash, slash instead of underscore). Paste the raw token directly without decoding it first.

How do I generate a JWT for testing?

Enter a JSON payload in the payload panel. A minimal test payload is: {"sub": "user123", "iat": 1700000000, "exp": 1700003600}. Enter any string as your secret, select HS256, and the signed token appears instantly. Copy it to use in Authorization headers or paste it into the JWT Decoder to inspect the claims.

How do I set the exp claim correctly?

exp is a Unix timestamp (seconds since 1 January 1970 UTC). To set a 1-hour expiry, take the current Unix timestamp and add 3600. For a 15-minute expiry add 900. Use the Timestamp Converter tool to get the current Unix timestamp, then add the desired seconds and paste the result into your payload.

How long should a JWT access token be valid?

15 minutes is the standard recommendation for access tokens in production. Short expiry limits the exposure window if a token is stolen. Pair them with a longer-lived refresh token (7 to 30 days) stored in an HttpOnly cookie, exchanged silently for new access tokens without requiring the user to log in again.

Can I use JWT for session management?

Yes, but with trade-offs. JWTs are stateless so you cannot invalidate an individual token before it expires without maintaining a server-side blocklist, which negates the stateless benefit. For applications that need immediate logout or revocation, traditional server-side sessions with a session store are simpler. JWTs are best for stateless APIs, microservices, and short-lived credentials.

Related Tools