JWT Token Generator
Generate JWT tokens with custom claims, expiration, and algorithm selection for testing APIs.
Header (auto-generated)
{
"alg": "HS256",
"typ": "JWT"
}Payload Claims
Payload JSON
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1774866292
}Signing Secret (HS256)
This secret is used to sign the token. Keep it confidential in production.
Encoded JWT Token
Security Note
JWT payloads are Base64URL-encoded, not encrypted. Anyone can decode and read the payload. Never store sensitive data (passwords, credit card numbers) in JWT claims. Token signing happens entirely in your browser using the Web Crypto API.
Related Tools
JWT DecoderNEW
Decode and inspect JWT tokens. View header, payload, and verify signature.
Password GenNEW
Generate strong, secure passwords with customizable length, symbols, and complexity.
Hash GenNEW
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text instantly.
Base64NEW
Encode text to Base64 or decode Base64 to text instantly. Supports UTF-8.
Frequently Asked Questions
What is a JWT (JSON Web Token)?
What are JWT claims?
What is HS256?
Is it safe to use JWTs for authentication?
Can JWT payload data be read without the secret?
What is the difference between HS256 and RS256?
How to Use the JWT Generator
JSON Web Tokens are the de facto standard for stateless authentication in modern web applications. Our JWT generator lets you create properly formatted and signed tokens for development, testing, and learning purposes. Build tokens with custom claims and sign them with HS256 directly in your browser.
Step 1: Configure the header. The JWT header specifies the token type and signing algorithm. Our generator uses HS256 (HMAC-SHA256) by default, which is the most widely supported and commonly used algorithm. The header is automatically generated based on your selection.
Step 2: Add payload claims. Add claims to your JWT payload using the add/remove interface. Common claims include sub (subject/user ID), iss (token issuer), exp (expiration time), and iat (issued at time). You can add any custom claims needed for your application.
Step 3: Set your signing secret. Enter the secret key used to sign the token. This key must be kept confidential and should be shared only with services that need to verify the token. Use a strong, random string of at least 32 characters for production use.
Step 4: Generate and copy. The encoded JWT token is generated in real-time as you modify claims. Copy the complete token or individual parts (header, payload, signature) for use in your application, API testing tool, or development environment.
Understanding JWT Structure
A JWT consists of three Base64URL-encoded parts separated by dots. The header contains metadata about the token, specifically the signing algorithm (alg) and token type (typ). The payload contains claims, which are statements about the user and additional metadata. The signature is computed by hashing the encoded header and payload with the secret key.
The signature ensures the token has not been tampered with. When a server receives a JWT, it recomputes the signature using its copy of the secret key and compares it to the signature in the token. If they match, the token is authentic and the claims can be trusted. If they do not match, the token has been modified and should be rejected.
It is critical to understand that JWTs are not encrypted by default. The payload is merely Base64URL-encoded, which is a reversible encoding. Anyone who intercepts a JWT can read its contents. If you need to transmit sensitive data, use JWE (JSON Web Encryption) or encrypt the entire JWT as an additional layer.
JWT Best Practices for Developers
Set short expiration times. Tokens should expire quickly, typically between 15 minutes and 1 hour for access tokens. Use refresh tokens (stored securely) to issue new access tokens without requiring the user to log in again. This limits the damage window if a token is compromised.
Validate all standard claims. Always validate exp (expiration), iss (issuer), and aud (audience) claims on the server. Do not trust the token blindly just because the signature is valid. Check that the token was issued by your service, intended for your service, and has not expired.
Use strong secrets. For HS256, use a secret key of at least 256 bits (32 bytes). Generate it using a cryptographically secure random number generator. Never use simple strings like "secret" or "password" as your signing key. Rotate secrets periodically and have a plan for handling key rotation.
Why Use Our JWT Generator?
Real-time token generation. See your JWT update instantly as you add or modify claims. The three-part structure is color-coded for easy identification of the header, payload, and signature sections.
Complete privacy. Your secret key and token claims never leave your browser. The HS256 signing is performed entirely client-side using the Web Crypto API. This is critical for development workflows where tokens may contain production-like data.
Educational tool. Understanding JWT structure is essential for web developers. Our generator shows the decoded header and payload alongside the encoded token, making it easy to understand how each part contributes to the final token.