Skip to content
Training & education

What is ML-KEM? The post-quantum replacement for RSA and ECDH

9 min

ML-KEM is the algorithm that replaces RSA and ECDH for key exchange. It was standardised by NIST in August 2024 as FIPS 203, it is implemented in OpenSSL, Chrome, Firefox and Cloudflare, and it is protecting a large share of real internet traffic today. It also does not do what most people assume it does, and clearing that up first saves a lot of confusion.

Pitfall

ML-KEM does not encrypt your message

It is a key encapsulation mechanism. It agrees on a shared secret between two parties, and a symmetric cipher like AES-GCM does the actual encrypting. If you were picturing a drop-in replacement for RSA encryption, that picture is wrong, and it is the single most common misunderstanding about the migration.

What encapsulation actually means

It is a three-step dance, and it is genuinely simpler than the RSA version once you see it.

  • You publish a public key. Anyone can have it.
  • Someone who wants to talk to you runs encapsulate against that public key. It hands them two things: a random shared secret, and a ciphertext that carries that secret to you. They send you the ciphertext.
  • You run decapsulate on the ciphertext with your private key, and you get the same shared secret back.

Now you both hold the same secret and nobody watching the wire does. You use it to key AES-GCM and encrypt whatever you actually wanted to send. If that pattern feels familiar it should: it is exactly what ECDH does, which is why ECDH is the better mental model for ML-KEM than RSA is.

1. the KEM moves a secrettheir public keyencapsulateshared secretciphertext1,088 bytessentdecapsulatewith private keyrecovers the same secret2. a symmetric cipher moves the messageyour messageAES-GCMkeyed by that secretencrypted message
The KEM moves a secret. A symmetric cipher moves the message. These are two separate steps, and conflating them is the most common mistake about ML-KEM.

The encrypt and sign playground shows this split explicitly. Encrypt something with ML-KEM and you get back two separate fields: the encapsulated key and the message ciphertext. Do the same with RSA and there is no encapsulated key at all.

What makes it quantum-resistant

RSA and elliptic curve both rest on problems that Shor's algorithm solves. ML-KEM rests on a different one, called Module Learning With Errors, which no known quantum algorithm solves efficiently.

The intuition: it works with lattices, regular grids of points in very high-dimensional space, and deliberately adds small random errors to its equations. Recovering the original values from noisy equations in a few hundred dimensions is hard for classical and quantum computers alike. Shor's algorithm is a specialised tool for periodicity, and there is no periodicity here for it to find.

Decision

Lattice schemes can and do break

HAWK, a lattice signature scheme in the third round of NIST's additional-signatures process, was withdrawn in July 2026 after an AI-found structural weakness. ML-KEM was unaffected: different construction, different mathematics, and years more scrutiny. But it is a reminder that newer schemes deserve caution and that hybrid deployment exists for a reason.

Which parameter set

Parameter setNIST categoryPublic keyCiphertextComparable to
ML-KEM-512Category 1800 B768 BAES-128
ML-KEM-768Category 31,184 B1,088 BAES-192
ML-KEM-1024Category 51,568 B1,568 BAES-256
The three parameter sets, and what they cost

ML-KEM-768 is the default you want unless something tells you otherwise. It is what browsers deploy, what Cloudflare serves, and what most guidance converges on. Use ML-KEM-1024 where policy requires category 5, which in practice means CNSA 2.0 and national security systems.

The cost, stated plainly

X25519ML-KEM-768Change
Public key32 B1,184 B37x larger
Ciphertext32 B1,088 B34x larger
Speedfastcomparable or fasternot the problem
What changes when you replace ECDH with ML-KEM-768

Speed is not the issue. Size is. A TLS ClientHello that comfortably fit in one packet may no longer, and anything with tight buffers, embedded devices, constrained radio links, may need real work. This is the actual migration cost and it is worth measuring rather than assuming.

Why almost everyone deploys it hybrid

In practice ML-KEM is rarely deployed alone. The standard approach is hybrid: run X25519 and ML-KEM-768 together and combine both shared secrets, which is what X25519MLKEM768 in TLS does and what RFC 10024 specifies.

The reasoning is straightforward. ML-KEM is younger than the algorithm it replaces, so combining them means a break in either one leaves you no worse off than today. See hybrid key exchange explained for the construction.

Try it

OpenSSL 3.5 and later generates ML-KEM keys directly. If your OpenSSL is older, the key generator will make one in your browser so you can at least see the sizes.

For a worked example of ML-KEM in a real protocol, @nostr-wot/pq implements a hybrid ML-KEM-1024 and NIP-44 envelope for Nostr direct messages, sealed with XChaCha20-Poly1305. It is a compact, readable illustration of the pattern this guide describes: encapsulate, derive, encrypt with a symmetric cipher.

Frequently asked questions

Is ML-KEM the same as Kyber?

Nearly. Kyber was the submission name; ML-KEM is the standardised version in FIPS 203, and NIST made changes during standardisation. They are not interchangeable: a library implementing round-three Kyber will not interoperate with one implementing FIPS 203 ML-KEM. If a product says Kyber, ask which.

Can ML-KEM encrypt a file?

Not directly. It agrees a shared secret, and you use that secret with a symmetric cipher such as AES-GCM to encrypt the file. Every practical use of ML-KEM has a symmetric cipher next to it doing the actual work.

Which parameter set should I use?

ML-KEM-768 unless you have a specific requirement for category 5, in which case ML-KEM-1024. ML-KEM-768 is what browsers and major CDNs deploy, and it is the common interoperable choice.

Should I deploy ML-KEM on its own or hybrid?

Hybrid, in almost every case. Combining X25519 with ML-KEM-768 means a future break in either algorithm leaves you no worse off than you are today, and it is what the deployed internet is doing. Pure ML-KEM makes sense mainly where a mandate requires it.

Take the next step

Related reading

References

Get started

Turn quantum risk into a credential.

Book a discovery call and get an indicative scope and pricing for your organisation.