Back to JWT Secret Generator
JWT Signing Secret Generator
Generate a JWT signing secret for HMAC algorithms or a key pair for RS256 and ES256. Pick the right key for your algorithm and copy it straight into your environment variables.
All keys are generated in your browser with the Web Crypto API. For a quick HMAC secret, use the main JWT secret key generator.
Choosing the right signing key for your algorithm
| Algorithm | Key type | Minimum size |
|---|---|---|
| HS256 | Single HMAC secret | 256 bits / 32 bytes |
| HS384 | Single HMAC secret | 384 bits / 48 bytes |
| HS512 | Single HMAC secret | 512 bits / 64 bytes |
| RS256 | RSA private + public key pair | 2048-bit key |
| ES256 | ECDSA P-256 key pair | 256-bit curve |
How to generate a JWT signing secret
- Decide on the algorithm your application uses — HS256 is the common default.
- For HMAC, generate a random secret of at least 32 bytes; for RS256, generate a key pair.
- Store the private key or shared secret in an environment variable or secrets manager.
- Verify incoming tokens with the matching key and explicitly check the algorithm.
HMAC secret vs asymmetric key pair
An HMAC secret is fast and simple, but every service that verifies tokens also holds the key that can issue them. Asymmetric signing keeps the private key on the authorization server and distributes only the public key to verifiers — a better fit for microservices and third-party integrations. For session cookies rather than JWTs, see the session secret generator.
Related tools
- JWT secret key generator — generate and encode tokens with your secret.
- 32-character JWT secret — the standard HS256 key size.
- Random JWT secret generator — pure random keys.
- JWT validator — check a token's signature and claims.