← Back to all tools

🔐 JWT Generator

Create JSON Web Tokens with custom payloads and HMAC signing

About JWT Generator

Generate JSON Web Tokens (JWT) online with custom headers, payloads, and HMAC-SHA256 signing. This tool runs entirely in your browser — your secret key and data are never sent to any server. Perfect for developers testing authentication flows.

How to Use JWT Generator

  1. Select the signing algorithm (HS256, RS256, etc.)
  2. Enter the payload claims (sub, exp, iat, custom)
  3. Enter the secret key or upload a private key
  4. Click Generate to create the signed JWT
  5. Copy the token and decode it to verify

About JWT Generator

JSON Web Tokens (JWT) are the standard for stateless authentication in modern web applications and APIs. A JWT consists of three Base64-encoded parts: header (algorithm and type), payload (claims like user ID, expiration, roles), and signature (verification that the token wasn't tampered with). This generator creates properly signed JWTs for testing, development, and learning. It supports HMAC algorithms (HS256, HS384, HS512) for symmetric signing and RSA algorithms (RS256) for asymmetric signing. Understanding JWT structure is essential for implementing authentication, debugging auth issues, and securing APIs.

Frequently Asked Questions

What's the difference between HS256 and RS256?

HS256 uses a shared secret (same key signs and verifies) — simpler but the secret must be shared with all verifiers. RS256 uses a private/public key pair — private key signs, public key verifies. RS256 is preferred for distributed systems.

What claims should I include?

Standard claims: sub (subject/user ID), exp (expiration), iat (issued at), iss (issuer), aud (audience). Add custom claims for roles, permissions, or user data. Keep payloads small — they're sent with every request.

Are JWTs encrypted?

No — JWTs are signed, not encrypted. The payload is Base64-encoded (not encrypted) and can be read by anyone. Never put sensitive data (passwords, secrets) in a JWT. Use JWE (JSON Web Encryption) if you need encrypted tokens.

How long should JWTs last?

Access tokens: 15-60 minutes. Refresh tokens: days to weeks. Short-lived access tokens limit damage from theft. Refresh tokens allow getting new access tokens without re-authentication.

Can JWTs be revoked?

Not directly — they're valid until expiration. Workarounds: short expiration + refresh tokens, token blacklist (database check), or token versioning. This is the main tradeoff of stateless authentication.

Related Tools

JWT Decoder → Base64 Encoder → Hash Generator → Password Generator →