Encryption key generator
Generate a random symmetric key for AES or HMAC in hex or Base64. A 256-bit key is 64 hex characters or 44 Base64 characters.
runs in your browser · nothing uploaded
How to use it
- Choose the key size for your algorithm.
- Choose hex or Base64, whichever your library or config file expects.
- Copy the key into your secret store or environment variable.
Use the right size
AES keys are exactly 128, 192 or 256 bits; anything else is rejected. AES-256 is the common default. For HMAC, a key as long as the hash output (256 bits for SHA-256, 512 for SHA-512) gives full strength.
A key must be random bytes, not a password. If you must start from a password, run it through a key derivation function such as PBKDF2, scrypt or Argon2 with a salt.
Generate one in a terminal
openssl rand -hex 32 prints a 256-bit key as 64 hex characters, and openssl rand -base64 32 as 44 Base64 characters. Our run of both is in examples/generators.
Questions
Is the value sent to a server?
No. It is made in your browser with JavaScript and the Web Crypto API. Nothing is uploaded, logged or stored by us. For production secrets you may still prefer to generate them on the machine that uses them; the command for that is on this page.
How random is it?
Every value comes from crypto.getRandomValues, the browser's cryptographically secure random generator, which is seeded by the operating system. Characters are picked with rejection sampling, so none is more likely than another.
Do I also need an IV or nonce?
Yes, for most modes, and a new one for every message. AES-GCM uses a 96-bit nonce. The salt and nonce generator makes those, but in code you should generate a fresh nonce for each encryption rather than paste one in.