Needs: Go 1.24 or later · Last tested: 2026-10-12

Enable X25519MLKEM768 in Go servers

From Go 1.24, crypto/tls offers and prefers X25519MLKEM768 by default. Most Go servers get post-quantum key exchange simply by building with a current Go.

Before you start

Option 1: leave CurvePreferences unset (simplest)

If your tls.Config has no CurvePreferences, Go chooses its default list, which puts X25519MLKEM768 first.

  1. Search your code for it: grep -rn CurvePreferences .
  2. If nothing sets it, rebuild with Go 1.24 or later and redeploy. Nothing else to change.

Option 2: list the groups yourself

If you need a fixed list:

  1. Put X25519MLKEM768 first in CurvePreferences:
cfg := &tls.Config{
	MinVersion:       tls.VersionTLS12,
	CurvePreferences: []tls.CurveID{tls.X25519MLKEM768, tls.X25519, tls.CurveP256},
}
  1. Rebuild with Go 1.24 or later and redeploy.

Check it isn't switched off

The GODEBUG setting tlsmlkem=0 turns X25519MLKEM768 off. Make sure it isn't set in your environment or in your go.mod godebug block:

go env GODEBUG
grep -n godebug go.mod

Then scan your domain below.

Check the change

Scan your domain to see whether every host now uses post-quantum key exchange.

Related check: Does my server support X25519MLKEM768?