Secret Key Generator
Build custom-length secret keys with flexible character sets. Ideal for app secrets, webhook signing strings, and configurable entropy for your stack.
- Free
- No signup
- Private
Privacy & security: Your generated secrets and hashes are processed locally in your browser whenever possible and are not stored on our servers.
Your generated secrets and hashes are processed locally in your browser whenever possible and are not stored on our servers.
Overview
Build custom-length secret keys with flexible character sets. Ideal for app secrets, webhook signing strings, and configurable entropy for your stack.
Benefits
- Adjustable length up to 256 characters
- Toggle character classes
- Cryptographic randomness
- One-click copy
Use Cases
- Application secret keys
- Webhook HMAC secrets
- Internal service auth
- Config file placeholders
Users Also Use
How to Use
- Set length and character options.
- Click Generate.
- Copy the secret key.
What is a secret key?
A secret key is a long random string that an application keeps private and uses to sign or protect data. Common examples are the SECRET_KEY setting in Django, APP_KEY in Laravel, session and cookie secrets in Express, NEXTAUTH_SECRET, and the signing secret for JSON Web Tokens. If an attacker learns the key, they can forge sessions or tokens, so it must be unpredictable and kept out of source code.
How this generator works
Choose a length from 8 to 256 characters (32 by default) and the character sets to include: uppercase, lowercase, numbers and symbols. Every character is chosen with crypto.getRandomValues(), the browser's cryptographically secure random source. The key is created on your device and is not sent to or stored on our server.
How long should a secret key be?
- 32 characters using letters and numbers gives about 190 bits of randomness, which is enough for session secrets and most framework keys.
- For a JWT signed with HS256, use at least 256 bits of randomness, such as 43 or more letters and numbers. Our 256-bit Secret Generator gives exactly 32 random bytes.
- If the key goes into a .env file, a shell command or a URL, untick Symbols. Characters like $, # and & can be misread by shells and config parsers.
Storing and rotating keys
- Keep keys in environment variables or a secrets manager, not in Git.
- Use different keys for development, staging and production.
- Rotate a key straight away if it appears in a log, a screenshot or a public repository. Rotating a session secret signs everyone out, so plan it.
FAQ
- How long should a secret key be?
- For most apps, 32+ characters with mixed character types provides strong entropy.
- Are generated secrets stored?
- No. Generation is local only.
- Is a generated secret key safe to use in production?
- Yes. Keys are created with the Web Crypto API on your device and are never transmitted, so only you see them.
- Should I include symbols in my secret key?
- Symbols add strength per character, but they can break .env files and shell commands. Using letters and numbers and making the key a little longer is just as secure.
- What is the difference between a secret key and an API key?
- A secret key stays on your server and signs or protects data. An API key is given to a client to identify it when calling an API. Use the API Key Generator for those.