Application-Layer Protocol Negotiation (ALPN)
ALPN (Application-Layer Protocol Negotiation) is a
TLS extension that lets a client and server agree on the
application protocol, such as h2 or http/1.1, while
the TLS handshake is still in progress. The agreement
happens inside the handshake, so no extra round trip is
spent choosing a protocol before data flows.
What ALPN solves
ALPN removes the need for a separate negotiation step after TLS completes. A single port like 443 can serve HTTP/1.1, HTTP/2, and other protocols at the same time, and the client and server have to agree on which one to speak. Without ALPN, that agreement would cost an additional exchange after the encrypted channel is ready, delaying the first request.
ALPN folds the choice into the existing TLS handshake. The
client advertises the protocols it supports as part of the
first message it already sends, and the server picks one in
the message it already returns. Application data then starts
immediately under the agreed protocol. This is what makes
HTTP/2 practical over TLS, since browsers negotiate
h2 through ALPN rather than through an in-band upgrade.
How ALPN works in the handshake
ALPN runs as an extension carried in the ClientHello and ServerHello messages of the TLS handshake. The negotiation completes before any application data is sent, and it adds no network round trips of its own.
The flow has two steps:
- ClientHello: the client includes an
application_layer_protocol_negotiationextension holding a list of protocol identifiers, ordered by client preference. A typical browser sendsh2followed byhttp/1.1. - ServerHello: the server selects a single protocol from that list, usually the one it prefers most, and echoes the chosen identifier back in its own ALPN extension. Both sides then proceed with the selected protocol.
When the server supports none of the offered protocols, it
ends the handshake with a fatal no_application_protocol
alert rather than guessing. The selected identifier is also
available early enough for the server to choose a
certificate based on the negotiated protocol.
ALPN is visible on the wire
The protocol list and the server's choice travel in the cleartext portion of the handshake in standard TLS. This visibility lets network equipment tell which protocol a connection uses. Encrypted Client Hello (ECH) hides the ALPN values by encrypting the inner ClientHello.
Protocol identifiers
ALPN protocol identifiers are short byte strings registered with IANA, each naming one application protocol. The client offers identifiers it supports and the server returns the single identifier it selected. The common HTTP values:
| Identifier | Selects |
|---|---|
http/1.1 |
QUIC where TLS 1.3
is built into the transport, so ALPN is part of the QUIC
handshake rather than a separate TLS layer.
The registry also holds historical identifiers such as
Relationship to HTTP/2 and HTTP/3ALPN is the standard way clients and servers select an HTTP
version over a secure connection. HTTP/2 over TLS is
negotiated almost entirely through ALPN using the HTTP/3 depends on ALPN for protocol identification
inside the QUIC handshake, using the ExampleThe negotiated protocol is visible with A client offering
When the server supports HTTP/2, the handshake output reports the agreed protocol:
The See also
Last updated: June 5, 2026
|