Skip to the content

Lesson 246 of 296

HTTP/1.1 vs HTTP/2 vs HTTP/3

What you will learn

  • The problems with HTTP/1.1
  • What HTTP/2 changed: multiplexing, binary framing, header compression
  • Why HTTP/3 moved to QUIC over UDP
  • What this means for developers
On this page

HTTP/1.1 (1997)

  • Text-based and simple.
  • Keep-alive reuses a TCP connection for several requests.
  • Problem: one request at a time per connection. A slow response blocks the ones behind it: head-of-line blocking. Browsers worked around it by opening about six connections per host, and developers worked around it with tricks: bundling all JavaScript into one file, image sprites, spreading assets over several domains.
  • Headers (cookies, user agents) are sent in full, uncompressed, with every request.

HTTP/2 (2015)

  • Binary framing: messages are split into small frames, not plain text.
  • Multiplexing: many requests and responses travel at the same time over one TCP connection, as interleaved streams. No more six-connection limit; old bundling tricks are less needed.
  • Header compression (HPACK): repeated headers are not resent in full.
  • Stream prioritisation.
  • Server push existed but was rarely useful and browsers have removed support; preload hints (<link rel="preload">, 103 Early Hints) are used instead.
  • In practice HTTP/2 runs over TLS.

Remaining problem: it still runs on TCP. If one TCP packet is lost, TCP holds back all later data until it is re-sent, so every stream waits: head-of-line blocking moved down to the transport layer. On lossy mobile networks this hurts.

HTTP/3 (2022)

  • Runs on QUIC, a transport protocol built on UDP.
  • QUIC handles reliability per stream: a lost packet only delays its own stream.
  • Faster set-up: the transport and TLS 1.3 handshakes are combined into one round trip (zero for resumed connections).
  • Connection migration: a connection survives a change of network (Wi-Fi to mobile data) because it is identified by a connection ID, not the IP address and port.
  • Encryption is built in; there is no unencrypted HTTP/3.

Comparison

HTTP/1.1HTTP/2HTTP/3
TransportTCPTCPQUIC over UDP
FormatTextBinary framesBinary frames
Parallel requestsOne at a time per connection (~6 connections)Multiplexed streams on one connectionMultiplexed, independent streams
Head-of-line blockingHTTP levelTCP levelLargely removed
Header compressionNoHPACKQPACK
HandshakeTCP + TLSTCP + TLSCombined, 1 round trip (0 on resume)

What developers need to do

Mostly nothing in application code: the meaning of HTTP (methods, status codes, headers) is the same in all versions. CDNs and load balancers (Cloudflare, CloudFront, AWS ALB for HTTP/2) negotiate the best version with each browser automatically, using ALPN during the TLS handshake. Some firewalls block UDP, so browsers fall back to HTTP/2. Do re-check old HTTP/1.1 optimisations: domain sharding can even hurt with HTTP/2. Tools: the browser DevTools Network panel shows the "Protocol" column (h2, h3).

How to say it in an interview

"HTTP/1.1 handles one request at a time per connection, so browsers opened about six connections and we bundled assets. HTTP/2 multiplexes many streams over one TCP connection with binary framing and header compression, but a lost TCP packet still stalls every stream. HTTP/3 runs on QUIC over UDP, where streams are independent, the transport and TLS 1.3 handshakes are combined, and connections survive network changes. The semantics stay the same, so it is mainly a CDN and server configuration choice."

Key words

WordMeaning
Head-of-line blockingOne delayed item holding up everything behind it
MultiplexingMany streams sharing one connection
HPACK / QPACKHeader compression in HTTP/2 / HTTP/3
QUICA transport protocol over UDP used by HTTP/3
UDPA simple, connectionless transport without built-in reliability
ALPNTLS extension used to choose the HTTP version

Now prove it

This lesson is complete when you pass the quiz and all three practice levels.