Encryption Key
AES-256 needs 32 random bytes; HMAC-SHA-256 needs a key at least as long as the hash if you want full security. This page draws those bytes from Web Crypto and shows them as hex or Base64. The string is a key, not a password you will type. If it leaks, every ciphertext it protected is at risk until you rotate.
What the encryption key generator is for
Encryption is only as strong as its key. A key derived from a password, a timestamp, or any non-random source undermines the algorithm entirely, no matter how good that algorithm is.
This produces keys from the browser's cryptographic generator at the exact byte lengths AES and HMAC require.
Common uses
- Generating an AES key for application-level encryption
- Creating an HMAC signing key for API authentication
- Producing keys for a development or staging environment
- Filling a secrets manager entry that expects raw key material
What the output means in the real world
Copy the key into a secret manager or an HSM-backed KMS, then wipe the clipboard. Never commit it, never email it, never put it in a mobile app. Application code should load it at runtime. If this key encrypted production data and it appeared in a ticket, rotate: generate a new key, re-encrypt, destroy the old key's access.
How this fits into real work
NIST SP 800-57 and SP 800-131A describe key lengths. AES-128 remains acceptable; AES-256 is the usual corporate default. Do not invent a 64-bit 'AES' key.
Keys in .env files on developer laptops become production keys. Use a cloud KMS or Vault and wrap data keys. This generator is for lab material and for seeding a KMS, not for living in Git.
HMAC keys that are short passwords lose the hash's strength. If a human must remember something, that is a password and belongs in a KDF, not in this box.
How to use this tool
- Choose the key type and size — AES-256 needs 32 bytes, AES-128 needs 16.
- Select hex or Base64 output to match what your library expects.
- Generate and place the key straight into a secrets manager.
- Never hardcode it in source or commit it to version control.
Tips
- Use a different key per environment so a staging leak cannot decrypt production data.
- Plan for rotation before you need it — that means versioning keys and being able to decrypt with an old one.
- AES-128 remains secure; AES-256 mainly buys margin against future advances.
Privacy & how it works
Everything happens inside your browser. The values you type are held in page memory only, are never sent to a server, and disappear when you close the tab. You can confirm this in your browser's network tab: the only request a tool makes is one that names the tool for a usage count, with nothing you typed in it. The tools also work with the internet disconnected. Randomness comes from crypto.getRandomValues(), the browser's cryptographically secure generator, not Math.random(). Math.random() is seeded predictably and must never be used for anything security-related, because an attacker who learns part of the sequence can reconstruct the rest. For production key material, generating on the server that will use it avoids trusting the browser at all.
Frequently asked questions
- AES-128 or AES-256?
- Both are considered secure. AES-256 offers a larger margin and is often mandated by compliance regimes; AES-128 is slightly faster and still beyond brute force.
- Is generating production keys in a browser safe?
- The Web Crypto API is a sound source and nothing is transmitted. For high-value production keys, best practice is still to generate them on the target system or in a hardware module.
Browse other tools
All tools run entirely in your browser — nothing you type is sent to a server, except the optional HIBP 5-character hash prefix.