DevToolStation

Keys & Generators

Secret & API Key Generator

Cryptographically random API keys, AES keys, HMAC secrets and tokens in hex, Base64 or Base32.

Loading the Secret & API Key Generator…

About the Secret & API Key Generator

Generate cryptographically random secrets for development and production: API keys with a prefix, HS256 JWT secrets, AES-128 and AES-256 keys, session and CSRF tokens, and TOTP secrets, encoded as hex, Base64, Base64url or Base32.

How to use it

  1. Pick a preset or set the number of random bytes.
  2. Choose the encoding and an optional prefix.
  3. Generate and copy.

Frequently asked questions

How long should a JWT HS256 secret be?
At least 32 random bytes (256 bits), which is what the preset generates.
Why prefix API keys?
Prefixes such as sk_live_ make keys easy to identify and let secret scanners detect leaked keys.
Are secrets generated securely?
Yes, with crypto.getRandomValues in your browser. Nothing is sent or stored.