How to do it
- Choose the format: hexadecimal, Base64, Base64url (no + / =) or UUID v4.
- Choose the size: 32 bytes (256 bits) for an HMAC-SHA256 secret.
- Copy the key, or make several in “Several at once”.
- Store it in an environment variable or a secrets vault.
Tips
- Never put a secret key in code pushed to a repository.
- Base64url works unescaped in a URL or file name.
- A UUID v4 identifies; for a secret, prefer 32 random bytes.
Frequently asked questions
How long should an API key be?
At least 128 bits (16 bytes); 256 bits (32 bytes) is the usual value for an HMAC-SHA256 signing secret or an encryption key.
How is the UUID v4 made?
122 random bits drawn with crypto.getRandomValues, plus the 6 bits fixed by the standard (version 4, RFC 4122 / 9562 variant).
Is the password sent anywhere?
No: it is created in your browser with cryptographic randomness (crypto.getRandomValues) and is neither sent nor saved; only your settings are kept on your device.