JWT Generator

Generate JWT tokens online for testing. Free JSON Web Token generator with HS256, RS256, and custom claims.

Runs locally in your browser
Header
Loading editor…
Payload
Loading editor…
Generated Token
Loading editor…

Generates tokens locally for testing. Does not replace production signing infrastructure. Use the JWT Decoder to inspect tokens. Never use unsigned or weak secrets in production.

What is JWT Generator?

A JWT generator creates JSON Web Tokens — compact, URL-safe strings that encode claims about a user or service and carry a cryptographic signature proving authenticity. JWTs power modern authentication in single-page applications, mobile apps, and microservices. A token consists of three Base64url-encoded segments separated by dots: header (algorithm and type), payload (claims like user ID and expiration), and signature (HMAC or RSA proof).

The header typically specifies the signing algorithm — HS256 (HMAC with SHA-256) for shared secrets, RS256 (RSA with SHA-256) for public/private key pairs. The payload contains registered claims (iss, sub, exp, iat) and custom claims your application defines. The signature is computed over header.payload using the secret or private key, allowing servers to verify the token was not tampered with and was issued by a trusted authority.

Our generator lets you edit header and payload JSON, select signing algorithms (HS256, HS384, HS512, RS256, and unsigned none for testing), enter secrets or PEM private keys, and produce signed tokens instantly. All signing happens locally in your browser — your secrets, private keys, and user claims never upload to external servers. This is essential when prototyping OAuth flows, debugging API gateways, and testing authorization middleware.

JWT generators are development and testing tools, not production token issuers. Production systems should use battle-tested server-side libraries (jsonwebtoken in Node.js, PyJWT in Python, java-jwt in Java) with proper key rotation, short expiration times, refresh token flows, and secure secret management via vaults. Never use the none algorithm or hardcoded secrets in production.

After generating a token, inspect it with the JWT Decoder to verify header, payload, and signature segments. Format claim JSON with the JSON Formatter, validate syntax with the JSON Validator, and understand Base64url encoding via Base64 Encode. For creating test credentials, use the Password Generator.

Backend developers, frontend engineers, QA testers, and security researchers use JWT generators when building authentication flows, writing integration tests for protected API endpoints, debugging 401 Unauthorized errors, demonstrating OAuth 2.0 concepts in documentation, and reproducing token-related bugs reported by customers.

When should you use JWT Generator?

Prototype authentication flows in SPAs and mobile apps before implementing server-side token issuance endpoints.

Generate test tokens with custom claims and expiration times for API integration tests and Postman collections.

Debug authorization middleware by creating tokens with specific roles, permissions, or audience claims.

Demonstrate JWT structure and signing in technical documentation, workshops, and security training sessions.

How to Use JWT Generator

  1. Edit the JWT header and payload JSON.
  2. Select signing algorithm and enter secret or private key.
  3. Click Generate JWT to create the signed token.
  4. Copy the token for API testing or debugging.

Features

  • Generate signed JWTs with HS256, HS384, HS512, and RS256 algorithms
  • Editable header and payload JSON with sensible defaults
  • Support for shared secrets and PEM private keys
  • Unsigned (none) algorithm for testing only
  • Custom claims: exp, iat, sub, aud, and arbitrary key-value pairs
  • One-click copy of the complete token string
  • 100% local signing — secrets never leave your browser
  • Instant token generation with no account required

Example

The header declares HS256 algorithm and JWT type. The payload contains subject (user123), name (Alice), and expiration (Unix timestamp). The tool Base64url-encodes both segments, computes an HMAC-SHA256 signature using the secret, and appends it as the third segment. The resulting three-part token can be sent as a Bearer token in Authorization headers for API testing.

JWT configuration

Header: {"alg":"HS256","typ":"JWT"}
Payload: {"sub":"user123","name":"Alice","exp":1735689600}
Secret: my-test-secret

Signed JWT token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIiwibmFtZSI6IkFsaWNlIiwiZXhwIjoxNzM1Njg5NjAwfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

Common Errors

Using none algorithm in production

Unsigned tokens accept any payload without verification, enabling complete authentication bypass.

Fix: Never accept alg:none in production. Use HS256 minimum with strong secrets or RS256 with key pairs.

Weak or hardcoded secrets

Short secrets like 'secret' or 'password' are trivially brute-forced for HMAC-signed tokens.

Fix: Use cryptographically random secrets of at least 256 bits; store in environment variables or vaults.

Missing or incorrect exp claim

Tokens without expiration remain valid indefinitely if stolen, amplifying breach impact.

Fix: Always set short exp values (15–60 minutes for access tokens) and implement refresh token rotation.

Invalid JSON in header or payload

Malformed JSON prevents token generation or produces unparsable segments.

Fix: Validate header and payload JSON with the [JSON Validator](/json-validator) before generating.

Confusing generation with verification

This tool creates tokens but does not verify signatures against trusted issuers.

Fix: Use the JWT Decoder to inspect tokens; implement server-side verification in your API gateway.

Best Practices

  • Use this tool only for development and testing — never as a production token issuer
  • Set short expiration times and include iat (issued at) claims in test tokens
  • Store signing secrets in environment variables or secret managers, never in source code
  • Prefer RS256 with key pairs over HS256 shared secrets in distributed microservice architectures
  • Decode generated tokens with the JWT Decoder to verify claims before using in tests
  • Never commit generated tokens or secrets to version control repositories
  • Implement refresh token flows for long-lived sessions instead of extending access token exp
  • Validate tokens server-side on every request — client-side JWT parsing is not authentication

Related Tools

Frequently Asked Questions

No. This generates tokens for testing. Use JWT Decoder to inspect them.