🔐 AES Key Generator – Create Secure Encryption Keys Instantly
The AES Key Generator produces cryptographically secure random symmetric keys for the Advanced Encryption Standard (AES) algorithm — entirely in your browser, with zero server interaction. Whether you need a key for AES-CBC, AES-GCM, or AES-CTR, this tool generates production-ready keys in seconds.
What Is an AES Key?
An AES key is a fixed-length sequence of random bytes used to encrypt and decrypt data. AES supports three standardized key lengths: 128-bit (16 bytes), 192-bit (24 bytes), and 256-bit (32 bytes). The key must be kept secret — anyone who holds the key can decrypt the data.
AES is a symmetric cipher, meaning the same key is used for both encryption and decryption. This is different from asymmetric systems like RSA, which use separate public and private keys. AES is used in TLS/HTTPS, Wi-Fi (WPA3), file encryption tools (e.g., VeraCrypt), cloud storage, and virtually every secure communication protocol.
Key Size Comparison
| Key Size | Bytes | Security Level | Use Case |
|---|---|---|---|
| 128-bit | 16 | ~equivalent to RSA-3072 | Performance-critical apps, IoT |
| 192-bit | 24 | Between 128 and 256 | Rarely used in practice |
| 256-bit ✓ | 32 | ~equivalent to RSA-15360 | High-security, long-term storage |
For new systems, AES-256 is the recommended choice. It provides the highest security margin and is the standard for protecting classified government information under NIST FIPS 197.
How Key Generation Works
This tool uses the Web Crypto API built into all modern browsers — specifically crypto.subtle.generateKey() — to generate keys using the operating system's cryptographically secure random number generator (CSPRNG). This is the same entropy source used by OpenSSL, Node.js crypto, and native OS APIs like/dev/urandom on Linux.
// Web Crypto API — random AES-256 key
const key = await crypto.subtle.generateKey(
{ name: "AES-GCM", length: 256 },
true, // extractable
["encrypt", "decrypt"]
);
const raw = await crypto.subtle.exportKey("raw", key);Output Formats
Generated keys can be exported in three common formats:
- Hexadecimal — a string of hex digits (0–9, a–f), 64 characters for a 256-bit key. Common in configuration files, environment variables, and cryptographic protocols.
- Base64 — compact ASCII encoding, 44 characters for a 256-bit key. Widely used in JWTs, PEM files, and API authentication headers.
- Binary — space-separated bit strings for each byte. Useful for educational purposes or low-level debugging.
The tool also shows both Hex and Base64 simultaneously, so you can copy whichever format your library or framework expects without running additional conversions.
PBKDF2 Passphrase-Based Derivation
When you need to derive a key deterministically from a passphrase (so the same passphrase always yields the same key), use the PBKDF2 mode. PBKDF2 (Password-Based Key Derivation Function 2) is defined in RFC 8018 / NIST SP 800-132 and is implemented natively in the Web Crypto API.
You provide a passphrase, a random salt (at least 16 bytes recommended), an iteration count (≥ 600 000 for SHA-256 per current NIST guidance), and a hash algorithm. The higher the iteration count, the more computationally expensive it becomes to brute-force the passphrase, at the cost of slightly longer derivation time.
Important: Unlike random generation, the security of a PBKDF2-derived key depends entirely on passphrase strength. Use a long, random passphrase (e.g., a 5-word passphrase or a randomly generated string ≥ 20 characters).
Understanding Shannon Entropy
Shannon entropy measures how uniformly distributed the byte values in a key are, on a scale of 0.0 to 8.0 bits per byte. A perfect random key has a score close to 8.0. Low entropy indicates that some byte values appear much more frequently than others, which can weaken the cryptographic properties of the key.
Keys generated by this tool consistently score between 7.7 and 8.0 due to the CSPRNG used by Web Crypto API. The Inspect tab lets you verify the entropy of any existing key you provide.
Key Fingerprint for Identification
The tool computes a SHA-256 fingerprint of every generated key — the first 16 hex characters of the hash, prefixed with sha256:. The fingerprint uniquely identifies a key without revealing any of its bytes. You can use fingerprints to:
- Verify that two parties hold the same key
- Track which key version was used to encrypt a dataset
- Audit key rotation logs without exposing key material
Security Best Practices
- Never share generated keys via email, chat, or plain HTTP.Always use encrypted channels (e.g., TLS, encrypted messaging).
- Store keys in a secrets manager such as AWS Secrets Manager, HashiCorp Vault, Azure Key Vault, or GCP Secret Manager. Never hard-code keys in source code or commit them to version control.
- Rotate keys periodically, especially after a suspected breach. Retain old keys only long enough to decrypt existing data, then destroy them securely.
- Use a different key for each environment (development, staging, production). Never reuse production keys in test environments.
- For AES-GCM, never reuse the same (key, IV) pair. Generate a fresh random 12-byte nonce for every encryption operation.