Random Secret Key Generator
Generate cryptographically secure keys with adjustable byte length in hex, Base64, or URL-safe Base64 formats for APIs and application secrets.
🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.
How the random secret key generator works
- Choose a format - hex, Base64, or URL-safe Base64.
- Pick a key length in bytes.
- Copy the generated key, created using a cryptographically secure random source.
FAQ
How random is the generated key?
It uses the Web Crypto API's crypto.getRandomValues(), a cryptographically secure random number generator suitable for generating secrets, API keys, and encryption keys - not Math.random().
What format should I choose?
Hexadecimal is common for API keys and tokens. Base64 is more compact and common in JWTs and config files. Base64 URL-safe avoids characters that need escaping in URLs.
What key length should I use?
32 bytes (256-bit) is a solid default for most secrets like session keys or API tokens. Use 16 bytes (128-bit) for less critical uses, or 48-64 bytes for extra-high-security applications.
Is the key ever sent anywhere?
No - it's generated and displayed entirely in your browser. Nothing is transmitted or logged.
Where should I store the key once I've generated it?
Treat it like a password: put it in a secrets manager or environment variable, not in source control, a chat message, or an unencrypted file.
How we compare
| Feature | Online Tool Store | Typing a password yourself | Command-line openssl rand |
|---|---|---|---|
| Cryptographically secure randomness | ✓ | ✗ | ✓ |
| No terminal required | ✓ | ✓ | ✗ |
| Multiple output formats | ✓ | ✗ | ✓ |
Useful for quickly generating a strong API key, session secret, or encryption key during development.