ML-KEM, the Module-Lattice-Based Key-Encapsulation Mechanism, is the post-quantum algorithm standardized by NIST in FIPS 203 that lets two parties establish a shared secret key over an insecure channel, with security resting on the hardness of lattice problems that quantum computers are not known to solve efficiently. In quantum security, it is the primary replacement for RSA and elliptic-curve key exchange, both of which fall to Shor’s algorithm on a sufficiently large machine.
ML-KEM grew out of CRYSTALS-Kyber, the winning key-establishment submission in the NIST PQC standardization process, and is often still called Kyber. The final standard was published in August 2024 and is now deployed in browsers, TLS libraries, messaging protocols and VPNs, usually combined with a classical algorithm in hybrid key exchange.
How ML-KEM encapsulates a shared key
ML-KEM works as a key-encapsulation mechanism (KEM) rather than as general-purpose encryption: it generates and transports a fresh random secret instead of encrypting a chosen message. The interface consists of three algorithms, which together replace the Diffie-Hellman handshake familiar from classical protocols.
- KeyGen produces an encapsulation key (public) and a decapsulation key (private).
- Encaps takes the encapsulation key and outputs a ciphertext plus a 32-byte shared secret.
- Decaps takes the decapsulation key and the ciphertext and recovers the same 32-byte secret.
Internally, ML-KEM first builds a public-key encryption scheme called K-PKE and then hardens it with a variant of the Fujisaki-Okamoto transform. The transform re-encrypts the decrypted value during decapsulation and compares the result with the received ciphertext. If they differ, the algorithm returns a pseudorandom value derived from a secret seed, a technique known as implicit rejection. This design gives IND-CCA2 security, meaning an attacker who can submit chosen ciphertexts still learns nothing useful about the key.
The following table summarizes the role of each component in a typical exchange.
| Component | Held by | Purpose |
|---|---|---|
| Encapsulation key | Published by the receiver | Lets anyone encapsulate a secret to the receiver |
| Decapsulation key | Kept private by the receiver | Recovers the secret from a ciphertext |
| Ciphertext | Sent by the initiator | Carries the encapsulated secret |
| Shared secret | Derived by both sides | Feeds a key derivation function for session keys |
The module-lattice mathematics behind ML-KEM
The security of ML-KEM rests on the Module Learning With Errors (MLWE) problem, a structured form of learning with errors. An attacker sees a public matrix A and a vector t = As + e, where s and e are small secret polynomials. Recovering s requires solving a noisy linear system, and the best known classical and quantum algorithms for this task run in exponential time.
All arithmetic happens in the polynomial ring of degree n = 256 with coefficients modulo the prime q = 3329. The module rank k (2, 3 or 4) sets the size of the matrix and therefore the security level. Multiplication uses the number-theoretic transform (NTT), a finite-field analogue of the fast Fourier transform, which makes ML-KEM faster than X25519 on many processors despite its larger messages.
Ciphertexts are compressed by dropping low-order bits, which shortens them but adds a small amount of noise. As a result, decryption can fail with a tiny, quantified probability, between roughly 2^-139 and 2^-174 depending on the parameter set, which is far below any practical concern.
ML-KEM parameter sets and key sizes
FIPS 203 defines three parameter sets that map to NIST security categories, where category 1 is comparable to AES-128, category 3 to AES-192 and category 5 to AES-256. The table lists the byte sizes of each object.
| Parameter set | Module rank k | NIST category | Encapsulation key | Ciphertext |
|---|---|---|---|---|
| ML-KEM-512 | 2 | 1 | 800 bytes | 768 bytes |
| ML-KEM-768 | 3 | 3 | 1,184 bytes | 1,088 bytes |
| ML-KEM-1024 | 4 | 5 | 1,568 bytes | 1,568 bytes |
ML-KEM-768 is the default choice for most systems because it offers a comfortable margin against future cryptanalysis at modest cost. ML-KEM-1024 is required for national security systems under the US CNSA 2.0 suite, while ML-KEM-512 suits constrained links where every byte matters. The decapsulation key is larger still, from 1,632 to 3,168 bytes, because it stores the encapsulation key and a hash alongside the secret vector.
How ML-KEM compares with classical and other post-quantum schemes
ML-KEM trades larger public data for quantum resistance and strong performance. The comparison below places it next to the algorithms it replaces and the alternatives it competes with.
| Scheme | Hard problem | Public key size | Quantum resistant |
|---|---|---|---|
| X25519 | Elliptic-curve discrete logarithm | 32 bytes | No |
| RSA-3072 | Integer factorization | About 384 bytes | No |
| ML-KEM-768 | Module learning with errors | 1,184 bytes | Yes |
| HQC | Decoding quasi-cyclic codes | About 2.2 to 7.2 KB | Yes |
| Classic McEliece | Decoding binary Goppa codes | About 261 KB to 1.3 MB | Yes |
NIST selected HQC in 2025 as a backup KEM based on a different mathematical family, so that a breakthrough against lattices would not leave the ecosystem without a standardized option. ML-KEM handles key establishment only; digital signatures are covered by its companion standards ML-DSA, SLH-DSA and FN-DSA.
Deploying ML-KEM in real protocols
Most deployments today use ML-KEM inside hybrid key exchange, combining it with a classical algorithm so that the session stays secure if either component is broken. The TLS 1.3 group X25519MLKEM768 concatenates the outputs of X25519 and ML-KEM-768 and is enabled by default in major browsers and content delivery networks. The main motivation is the harvest now, decrypt later threat, in which adversaries record encrypted traffic today to decrypt it once a cryptographically relevant quantum computer exists.
The decision table below reflects common engineering practice.
| Situation | Recommended choice | Reason |
|---|---|---|
| Public web traffic over TLS 1.3 | X25519MLKEM768 hybrid | Broad support and defense in depth |
| National security systems | ML-KEM-1024 | Mandated by CNSA 2.0 |
| Long-lived archives or VPN tunnels | ML-KEM-768 or 1024 in hybrid mode | Data must stay confidential for decades |
| Constrained IoT radio links | ML-KEM-512 | Smallest messages at category 1 |
Because the encapsulation key exceeds 1 KB, the larger ClientHello message can split across TCP packets, and some poorly written middleboxes have dropped such handshakes. Testing network paths is therefore part of any quantum-safe migration, together with a cryptographic inventory and a crypto-agile design that allows parameters to change later.
Limitations and implementation pitfalls
The mathematics of ML-KEM is well studied, but most real risks lie in implementations. The KyberSlash findings of 2023 and 2024 showed that a division by a secret-dependent value could leak key bits through timing side channels on some processors. Key points to watch are listed below.
- Constant-time code is mandatory; no branches or memory accesses may depend on secret data.
- Implicit rejection must be implemented exactly, or chosen-ciphertext attacks become possible.
- Key reuse is safe for ML-KEM, unlike some earlier lattice proposals, but ephemeral keys still give forward secrecy.
- Masking against power analysis is needed on smart cards and embedded devices exposed to physical attackers.
- Confidence in lattice hardness is high, yet it is younger than confidence in factoring, which is why hybrid deployment remains the cautious default.
In simple terms
ML-KEM is a way for two computers to agree on a secret password while strangers listen to every word they exchange. One side publishes an open padlock. The other side locks a random secret inside a box with that padlock and sends the box back. Only the owner of the matching key can open it.
Today, most of the internet uses padlocks that a future quantum computer could pick. ML-KEM is a new kind of padlock built from a math puzzle full of deliberate noise, and no known computer, quantum or ordinary, can solve that puzzle in reasonable time. The key takeaway is simple: it keeps private conversations private even after quantum computers arrive.
A practical example
A regional hospital network stores patient records that must remain confidential for at least 30 years. Its security team worries that traffic between clinics and the central data center could be recorded now and decrypted later. During a scheduled upgrade, the team enables the X25519MLKEM768 hybrid group on its TLS 1.3 load balancers and reconfigures site-to-site VPN tunnels to use ML-KEM-768 alongside the existing elliptic-curve exchange.
Testing reveals that one older firewall drops handshakes once the ClientHello grows by about 1,200 bytes, so the team updates its firmware before rollout. After deployment, handshake latency rises by less than one millisecond on average, and every new session now carries quantum-resistant protection for the data that matters most.