About the Secret Key Generator
The Secret Key Generator creates random bytes for application secrets: JWT signing secrets, encryption keys, cookie and session secrets, and webhook signing keys. Choose 16, 24, 32, 48 or 64 bytes (128 to 512 bits) and an output format of hex, Base64, Base64 URL-safe or printable ASCII.
How to use the Secret Key Generator
- Choose the key size; 32 bytes (256-bit) is a common default.
- Choose the format your application expects.
- Copy the key into your environment variables or secrets manager.
Example
Laravel APP_KEY style
A 32-byte key in Base64 is 44 characters long, the format Laravel uses after the base64: prefix.
Frequently asked questions
Where should I store secret keys?
In environment variables or a secrets manager, never in source code or a public repository.
How big should the key be?
256 bits (32 bytes) suits most symmetric encryption and HMAC uses.
Can I regenerate a lost key?
No. Random keys cannot be recreated; data encrypted with a lost key cannot be decrypted.