JWT Secret Generator

Keys for HS256 and HS512, at least as long as the hash output.

Very strong0 bitsGenerated in your browser

Local alternative

openssl rand -base64 32

Prefer generating secrets on the machine that uses them? This command produces an equivalent value.

Official documentation

For HMAC-signed JSON Web Tokens the key length determines how secure the signature is. RFC 7518 requires a key at least as long as the hash output: 32 bytes for HS256, 64 bytes for HS512. Using a short, human-readable passphrase as a JWT secret is a common and serious mistake, because it can be brute-forced offline.

Frequently asked questions