Secret Key Generator

Generate a strong random secret for your app's configuration — JWT, sessions, API keys — in the format you need.

● 🔒 Your data is processed locally in your browser with the Web Crypto API and is never uploaded to our servers.

How to generate a secret key

  1. Choose the type: prefixed key (sk_live_…), hex secret, Base64URL secret, alphanumeric, UUID v4, JWT HS256 secret, salt or AES-GCM IV.
  2. Set the strength in random bytes — 32 bytes (256 bits) is a safe default — and, for prefixed keys, the prefix.
  3. Choose how many keys you need and click Generate, then copy.

Which format for which framework?

WhereSettingGood choice
DjangoSECRET_KEYAlphanumeric or Base64URL, 50+ characters
Railssecret_key_baseHex, 64 bytes (128 characters)
LaravelAPP_KEYbase64: + 32 random bytes in Base64
Express / Flask sessionsSESSION_SECRET, SECRET_KEYHex or Base64URL, 32 bytes
JWT signed with HS256Signing secretJWT HS256 secret (256-bit)
Your own APIAPI keys for clientsPrefixed key, like sk_live_…

Frameworks also have their own commands: bin/rails secret, php artisan key:generate, or openssl rand -base64 32 anywhere.

Why prefixed keys?

A prefix like sk_live_ or pk_test_ tells at a glance what a key is for and which environment it belongs to. It also lets secret-scanning tools detect leaked keys in code repositories. Keep the random part long — the prefix adds no security by itself.

How to keep secrets safe

FAQ

How long should a secret key be?

At least 32 random bytes (256 bits). Longer doesn't hurt, but anything over 128 bits is already impossible to brute-force.

Is it safe to generate keys in a browser?

Yes, with the Web Crypto API: keys are created on your device from a cryptographically secure source and never uploaded. For production secrets, many teams still prefer generating them on the server.

Where are other key tools?

See the API Key Generator, the Random Bytes Generator and the RSA Key Pair Generator.