Secret Key Generator
Random secret keys for API tokens, JWT signing and app config, as hex or base64.
How it works
Creates random keys for software: JWT secrets, API tokens, session keys and .env values. Pick the number of random bytes and the format (hex, base64 or URL-safe base64). 32 bytes is 256 bits, which is the usual size for HMAC and AES-256 keys.
Worked example
32 bytes in hex is 64 characters like "9f2c...". The same 32 bytes in base64 is 44 characters.
Good to know
- Never commit secrets to Git. Keep them in environment variables.
- Make a new secret for each app and each environment.
- Rotate a secret if it was ever pasted into a chat or a public repo.
Common questions
- How many bytes do I need?
- 16 bytes (128 bits) is enough for most tokens. 32 bytes for signing keys.
- Hex or base64?
- Same strength. Base64 is shorter, hex is easier to read.
- Is it sent anywhere?
- No. It is made in your browser with the secure random generator.