FuntranslatorCreate Fun Language Translations
Free
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

AlgorithmKey typeMinimum size
HS256Single HMAC secret256 bits / 32 bytes
HS384Single HMAC secret384 bits / 48 bytes
HS512Single HMAC secret512 bits / 64 bytes
RS256RSA private + public key pair2048-bit key
ES256ECDSA P-256 key pair256-bit curve

How to generate a JWT signing secret

  1. Decide on the algorithm your application uses — HS256 is the common default.
  2. For HMAC, generate a random secret of at least 32 bytes; for RS256, generate a key pair.
  3. Store the private key or shared secret in an environment variable or secrets manager.
  4. 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