Skip to content

15 min read

HTTP/1.1 vs HTTP/2 vs HTTP/3: the differences

In one sentence: All three versions say the same thing (the same methods, codes and headers); what changes is how it travels: HTTP/1.1 sends text, one request at a time per connection; HTTP/2 sends many at once over a single TCP connection; and HTTP/3 does the same over QUIC, on UDP, so that one loss doesn't slow them all down.

What you will learn

  • Explain what problem each version solved, from HTTP/1.1's six connections to QUIC.
  • See with curl which version a client and a server agree on, and how many connections each one opens.
  • Find out whether a website speaks HTTP/3 with the alt-svc header and the Protocol column in DevTools.
  • Know what changes for a server when it moves from one version to another, and what stays the same.

Before you start, read: 01-request-and-response.md phase-0/06-tcp-vs-udp.md

Picture the home page of Ana and Luis’s shop: the HTML, two stylesheets, five scripts and forty product photos. Almost fifty files, all from the same server. A customer opens it on their phone, on a train, with a signal that comes and goes.

With HTTP/1.1, their browser requests the files six at a time, and the rest wait their turn. With HTTP/2, it requests them all at once over a single connection, but every time a piece gets lost along the way, they all stop. And when the train pulls into a station and the phone switches from 4G to Wi-Fi, the connection breaks and a new one has to start.

Each version of HTTP was born to fix the bottleneck of the one before. The methods, codes and headers in this phase are the same in all three: what changes is how they travel.

The analogy

Imagine you’re ordering food at a restaurant.

With HTTP/1.1, the waiter brings you one dish, and until it’s on the table you can’t ask for the next. To eat sooner, you call six waiters at once, and each one handles one dish.

With HTTP/2, you give the whole order to a single waiter, and the kitchen sends the dishes out as they’re ready. But everything comes out through the same serving hatch, in strict order: if the third dish is dropped, the fourth and fifth wait, even if they’re ready, until the third is made again.

With HTTP/3, each dish comes out through its own hatch: if one is dropped, only that one waits. And your order goes with a number, not with your table: if you move to the terrace, they keep bringing it to you.

Where the analogy breaks down

  • In HTTP/2 and HTTP/3, each response travels in pieces, and the pieces of several responses are interleaved. At the restaurant, each dish arrives whole.
  • Calling more waiters costs you nothing. Opening more connections does: each one pays for its own TCP and TLS handshake.
  • In HTTP/3 there aren’t really several hatches: everything travels over the same connection. What travels separately is the order of each response.

HTTP/1.1: one request at a time per connection

Section titled “HTTP/1.1: one request at a time per connection”

HTTP/1.1 dates from 1997, and it’s the text version you typed by hand in “What a protocol is”. Its connection stays open for the next request (the Connection: keep-alive from Phase 0), so the second request doesn’t repeat the handshakes.

But an HTTP/1.1 connection only carries one request at a time. The browser sends, waits for the whole response and only then sends the next one:

  1. Browser → Shop serverGET /
  2. Shop server → Browser200 OK + HTML
  3. Browser → Shop serverGET /styles.css
  4. Shop serverThis file is slow to go out
  5. Shop server → Browser200 OK + CSS
  6. Browser → Shop serverGET /img/t-shirt.jpg
  7. Shop server → Browser200 OK + image

If one response is slow, everything behind it on that connection waits. That’s Head-of-line blockingWhen the first thing in a line gets stuck and holds up everything behind it, even what’s ready to go. In HTTP/1.1 a slow response causes it; in TCP, a lost segment.Go to definition: the first thing in the queue gets stuck and holds up the rest, even if they’re ready. In “TCP vs UDP” you saw it inside TCP; here it happens one layer up, in HTTP.

The standard allows pipelining: sending several requests in a row without waiting. But the responses have to come back in the same order, so a slow one still holds up the rest, and some servers got it wrong. Chrome and Firefox never turned it on by default, and they ended up removing it: today no browser uses it.

So, in practice, a browser opens up to six connections to each server that speaks HTTP/1.1, each with its own TCP and TLS handshake. If the page needs fifty files, the rest queue up inside the browser: in the Timing tab of DevToolsThe developer tools that come with browsers such as Chrome or Firefox, opened with F12. Their Network tab shows every request the page makes, with its response and headers; the Console, the page’s errors; and Application (Storage, in Firefox), what the site stores in your browser, such as cookies.Go to definition, that time shows up as Queueing or Stalled.

HTTP/2: many requests at once over a single connection

Section titled “HTTP/2: many requests at once over a single connection”

HTTP/2HTTP stands for HyperText Transfer Protocol.The 2015 version of HTTP. It says the same as HTTP/1.1, but cut into pieces and in a format made for machines, not text, and it carries many requests at once over a single TCP connection. Browsers only use it with HTTPS.Go to definition (2015) doesn’t change what is said, but how it’s written. Messages travel in binary, cut into frames, and each frame carries the number of the stream it belongs to. Each request, with its response, is a stream, and the ones the browser opens get odd numbers: 1, 3, 5…

With that, the browser can send all its requests in a row, and the server can answer them in whatever order it wants, interleaving pieces:

  1. Browser → Shop serverstream 1: GET /
  2. Browser → Shop serverstream 3: GET /styles.css
  3. Browser → Shop serverstream 5: GET /img/t-shirt.jpg
  4. Shop server → Browserstream 1: HTML (first piece)
  5. Shop server → Browserstream 5: image (first piece)
  6. Shop server → Browserstream 3: CSS (whole)
  7. Shop server → Browserstream 1: HTML (rest)
  8. Shop server → Browserstream 5: image (rest)

This is called MultiplexingSending several things at once over the same channel, cut into pieces and interleaved, with a label on each piece that says which one it belongs to. HTTP/2 and HTTP/3 use it to carry many requests and responses over a single connection.Go to definition: many conversations over the same channel, cut into pieces with a label on each piece. A slow response no longer holds up the rest, and a single connection per server is enough: one TCP handshake and one TLS handshake, instead of six.

HTTP/2 brings two more changes:

  • Compressed headers. Every request repeats almost the same headers (User-Agent, Accept, the cookies). HTTP/2 sends what was already sent as a short number.
  • Pseudo-headers. HTTP/1.1’s first line, GET / HTTP/1.1, becomes fields like :method and :path, and Host becomes :authority. You saw them in “The TCP/IP model”.

How do the browser and the server know they’re going to speak HTTP/2? They agree on it inside the TLS handshake, with ALPNALPN stands for Application-Layer Protocol Negotiation.The part of the TLS handshake in which the client and the server choose which protocol they will speak next, for example HTTP/2 (h2) or HTTP/1.1. It’s settled without spending a single extra round trip.Go to definition, a TLS extension for choosing the application protocol. The client says what it can speak (h2, http/1.1) and the server chooses. It doesn’t cost a single extra round trip. And browsers only use HTTP/2 with HTTPS: without TLS, they stay on HTTP/1.1.

One problem remains. All the streams travel over a single TCP connection, and TCP delivers bytes in order: if a SegmentOne of the pieces TCP cuts the data into before sending it. It carries a header with the ports, the sequence number and the acknowledgment number (ACK), plus a chunk of the data. It travels inside an IP packet.Go to definition is lost, it holds back everything that arrives after it, whatever stream it belongs to. Head-of-line blocking has moved down from HTTP to TCP. On a good network you barely notice; on a train, a single loss slows down the whole page.

To remove that last bottleneck, TCP had to change, and TCP lives in the operating system of every computer and in the firewalls along the way: changing it across the whole internet would take decades. So a new transport was built on top of UDP, QUICQUIC stands for Quick UDP Internet Connections.The transport protocol of HTTP/3. It runs over UDP and does what TCP did (confirming receipt, resending what was lost and putting things in order), but it orders each request separately, and it carries TLS inside. It was born at Google with that long name; today’s standard uses just QUIC, as a name rather than an acronym.Go to definition, and HTTP/3HTTP stands for HyperText Transfer Protocol.The 2022 version of HTTP. It does the same as HTTP/2, but over QUIC, on UDP, instead of TCP. That way, a lost piece only delays its own request, and the connection survives a change of network.Go to definition (2022) is HTTP over QUIC.

QUIC redoes what TCP did: acknowledge what was received, resend what was lost and put things in order. The difference is that it orders each stream separately. As you saw in “TCP vs UDP”, a loss only delays the stream it belonged to; the others keep arriving.

It brings two more advantages:

  • One less round trip to connect. QUIC carries TLS 1.3 inside and does both handshakes, the transport one and the encryption one, in a single one. It’s the round trip HTTP/3 saved in “From URL to page”.
  • It survives a network change. A TCP connection is identified by four values: the IP and the port of each end (“IP, ports and sockets”). If your phone switches from Wi-Fi to 4G, your IP changes and the connection dies. QUIC identifies the connection with its own number, so it can carry on from the new address.

With HTTP/2 there was ALPN, but ALPN goes inside TLS, which runs over TCP. HTTP/3 runs over UDP: before connecting, the browser has nowhere to ask. So the first time it connects over TCP, as always, and the server tells it in a response header:

alt-svc: h3=":443"; ma=86400

It reads like this: “I also speak HTTP/3 (h3) on port 443, over UDP; remember it for 86,400 seconds,” which is one day. Alt-Svc stands for alternative service. From then on, new connections to that server go over QUIC. There’s a second, more recent way: a DNS record of type HTTPS that announces it before connecting.

If UDP is blocked, which happens on some company networks, QUIC never manages to connect and the browser carries on over TCP, with HTTP/2, without you noticing.

What changes for the server (and what doesn’t)

Section titled “What changes for the server (and what doesn’t)”
HTTP/1.1 HTTP/2 HTTP/3
Year 1997 2015 2022
Format Text Binary, in frames Binary, in frames
Connections per server Up to six One One
Requests at once per connection One Many Many
Transport TCP (and TLS, with HTTPS) TCP and TLS QUIC, over UDP, with TLS inside
Head-of-line blocking In HTTP and in TCP Only in TCP No, each stream separately
How it’s chosen By default ALPN, in the TLS handshake alt-svc or a DNS record

What doesn’t change is the meaning. All three share the same semantics standard, the RFC 9110 you saw in Phase 0. A GET is a GET, a 404 is a 404 and Cache-Control works the same in all three.

What does change is the work of whoever receives the connections. It’s almost never your program: in front of it there’s usually a web server like nginx, or a CDNCDN stands for Content Delivery Network.A network of servers spread around the world that serves a website from the one closest to each user, so the round trip is short. example.com sits behind Cloudflare’s.Go to definition, that speaks HTTP/2 and HTTP/3 with browsers and passes the requests on to your application, often in HTTP/1.1. This website is served by Cloudflare, and it’s Cloudflare that speaks HTTP/3 with you. And the shop’s nginx, on your VM, listens on port 8080 without TLS: it speaks HTTP/1.1, and that’s enough for it until you add HTTPS in Phase 8.

The goal: find out which version of HTTP this website really uses with you, and see with your own eyes the difference between several connections and a single one.

Start by forcing curl to speak HTTP/1.1. The -v option shows the handshake, and -o /dev/null throws away the page, which we’re not interested in:

1. With HTTP/1.1

Ventana de terminal
curl --http1.1 -sv -o /dev/null https://backenddesdecero.com/en/

What you will see:

* Connected to backenddesdecero.com (2606:4700:3036::ac43:aba8) port 443
* ALPN: curl offers http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
…
* ALPN: server accepted http/1.1
…
* using HTTP/1.x
> GET /en/ HTTP/1.1
> Host: backenddesdecero.com
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< Date: Tue, 13 Oct 2026 07:59:31 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< CF-Cache-Status: HIT
…
< alt-svc: h3=":443"; ma=86400
<
{ [732 bytes data]
* Connection #0 to host backenddesdecero.com left intact

Look at the two ALPN lines. curl offers a single version, http/1.1, and the server accepts it. It all happens inside the TLS handshake, before HTTP begins.

The response brings two headers you’ll miss in the next exercise: Transfer-Encoding: chunked (the content arrives in pieces, each with its size) and Connection: keep-alive. And at the end, alt-svc: the server announces HTTP/3.

We’ve cut part of the output, marked with …. The IP and the date will be different, and you may connect over IPv4. On Linux, the TLS lines start with TLSv1.3 instead of (304), and your version of curl may be different.

2. With HTTP/2

Ventana de terminal
curl --http2 -sv -o /dev/null https://backenddesdecero.com/en/

What you will see:

* Connected to backenddesdecero.com (2606:4700:3036::ac43:aba8) port 443
* ALPN: curl offers h2,http/1.1
…
* ALPN: server accepted h2
…
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://backenddesdecero.com/en/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: backenddesdecero.com]
* [HTTP/2] [1] [:path: /en/]
* [HTTP/2] [1] [user-agent: curl/8.7.1]
* [HTTP/2] [1] [accept: */*]
> GET /en/ HTTP/2
> Host: backenddesdecero.com
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/2 200
< date: Tue, 13 Oct 2026 07:59:31 GMT
< content-type: text/html
< cf-cache-status: HIT
…
< alt-svc: h3=":443"; ma=86400
<
{ [1360 bytes data]
* Connection #0 to host backenddesdecero.com left intact

Now curl offers h2,http/1.1, in order of preference, and the server chooses h2. Look at what changes:

  • [1] is the stream number. The request is stream 1, the first one the client opens.
  • HTTP/2 200 has no OK phrase: it disappeared in HTTP/2, and the code is enough.
  • The headers are lowercase. HTTP/2 requires it.
  • There’s no Connection or Transfer-Encoding anymore. The frames already say which stream each piece belongs to and where it ends, so those headers are unnecessary.

The > lines come out in HTTP/1.1 format, but that’s not what travels: it’s curl translating the frames so you can read them.

Now, what really changes: requesting several pages at once. --parallel tells curl to request all the URLs at once, each -o /dev/null throws away one of the three pages and -w writes one line per request, with the version and the new connections it opened:

3. Three pages at once, with HTTP/1.1

Ventana de terminal
curl --http1.1 --parallel -s -o /dev/null -o /dev/null -o /dev/null -w '%{url} HTTP/%{http_version} new connections: %{num_connects}\n' https://backenddesdecero.com/en/ https://backenddesdecero.com/en/phase-0/ https://backenddesdecero.com/en/phase-1/

What you will see:

https://backenddesdecero.com/en/ HTTP/1.1 new connections: 1
https://backenddesdecero.com/en/phase-0/ HTTP/1.1 new connections: 1
https://backenddesdecero.com/en/phase-1/ HTTP/1.1 new connections: 1

Three requests at once, three connections, each with its own handshakes. It’s what the browser does with HTTP/1.1. The lines come out in the order they finish, so yours may be different.

If you remove --parallel, curl requests the pages one after the other and you’ll see 1, 0 and 0: the last two reuse the first one’s connection thanks to keep-alive. Reusing is possible; what HTTP/1.1 can’t do is carry two at once.

4. The same, with HTTP/2

Ventana de terminal
curl --http2 --parallel -s -o /dev/null -o /dev/null -o /dev/null -w '%{url} HTTP/%{http_version} new connections: %{num_connects}\n' https://backenddesdecero.com/en/ https://backenddesdecero.com/en/phase-0/ https://backenddesdecero.com/en/phase-1/

What you will see:

https://backenddesdecero.com/en/ HTTP/2 new connections: 1
https://backenddesdecero.com/en/phase-0/ HTTP/2 new connections: 0
https://backenddesdecero.com/en/phase-1/ HTTP/2 new connections: 0

A single connection for all three: one request opens it (the one with the 1), and the other two travel over it at the same time, each in its own stream. That’s multiplexing. The order of the lines, again, may change.

What about HTTP/3? curl has the --http3 option, but only if it was built with QUIC support, and the ones on macOS and Ubuntu don’t have it:

5. HTTP/3 with curl, not yet

Ventana de terminal
curl --http3 -sI https://backenddesdecero.com/en/

What you will see:

curl: option --http3: the installed libcurl version doesn't support this
curl: try 'curl --help' or 'curl --manual' for more information

The installed libcurl doesn’t support it (libcurl is the part of curl that talks to the network). The error comes from your curl, not from the website, and on Linux you get the same one.

But you can see the announcement. -I requests only the headers and grep -i keeps the line you’re looking for, ignoring case (you saw it in lesson 3 of Phase 1). Compare this website with Wikipedia:

6. Who announces HTTP/3?

Ventana de terminal
curl -sI https://backenddesdecero.com/en/ | grep -i alt-svc
curl -sI https://www.wikipedia.org/ | grep -i alt-svc

What you will see:

alt-svc: h3=":443"; ma=86400

Only one line comes out: the second command writes nothing, because Wikipedia doesn’t announce HTTP/3, and your browser will talk to it over HTTP/2. Announcements can change: we checked in October 2026.

To see HTTP/3 for real, use the browser. In Chrome, open DevTools (F12, or Cmd + Option + I on a Mac) and go to the Network tab. Right-click the column headers and turn on Protocol. Then go to https://backenddesdecero.com/en/ in an incognito window, so you start with nothing saved:

  1. The first load. The document comes out with h2: the browser didn’t know anything yet. Some files that arrive later, like the fonts, may already come out with h3: as soon as it read the alt-svc, it opened a QUIC connection.
  2. Reload the page. Now the document also comes out with h3. Files the browser had already saved may still say h2: they haven’t traveled again.
  3. Visit other websites. The big ones, like Google, almost always come out with h3. Many others, like Wikipedia, with h2.

We checked it with Chromium, the open-source base of Chrome, in October 2026. If everything comes out h2 even after reloading, maybe your network blocks UDP. In Firefox, the column is also called Protocol, and it says HTTP/2 or HTTP/3.

  • The Protocol column in DevTools, with h2 and h3 on almost every website, already appeared in “What a protocol is”.
  • The ALPN lines in curl -v, in “The TCP/IP model”: they were HTTP/2 being chosen inside the TLS handshake.
  • The long Queueing or Stalled bars in the Timing tab, on old websites with many files: they’re requests waiting for one of HTTP/1.1’s six connections.

And if you code:

  • Your development server (Vite’s, on localhost:5173, for example) shows up as http/1.1 in the Protocol column: it runs without TLS, so there’s no ALPN.
  • In the console, performance.getEntriesByType('navigation')[0].nextHopProtocol returns the version the page arrived with: h2 or h3.
  • “To move to HTTP/2 I have to change my API.” Methods, codes and headers mean the same in all three versions. The change is made by whoever receives the connections, almost always nginx or a CDN.
  • “HTTP/3 is always faster.” On a good network and with a nearby server, the difference is small. You notice it with faraway servers and on networks with losses, like a train’s.
  • “I turned on HTTP/3 on the server and nobody uses it.” Check two things: that the response carries alt-svc and that the firewall lets port 443 through for UDP, not only for TCP.
  • “More subdomains, more speed.” That was true with HTTP/1.1, because of the six connections to each one. With HTTP/2, a single connection carries everything, and each extra domain adds DNS, TCP and TLS.
  • HTTP/1.1 carries one request at a time per connection, so browsers open up to six per server. Pipelining is in the standard, but browsers never turned it on.
  • HTTP/2 sends binary frames and multiplexes many requests over a single TCP connection, chosen with ALPN inside TLS. It still has TCP’s head-of-line blocking.
  • HTTP/3 runs over QUIC, on UDP: each stream recovers separately, it connects with one less round trip and it survives a network change. It’s announced with the alt-svc header.
  • All three mean the same: methods, codes and headers don’t change. What changes is the work of whoever receives the connections.
  • In Phase 3 you’ll write a server with Node’s http module, which speaks HTTP/1.1: your code will read the method, the path and the headers the same way, whatever version the browser uses.
An old website, with HTTP/1.1 only, loads 60 small files. In the Timing tab you see that almost all of them spend a long time “Stalled” before being sent. Why?

In curl -v you see “ALPN: curl offers h2,http/1.1” and, after that, “ALPN: server accepted http/1.1”. What happened?

You’re on a train, with a bad signal, and you open a website with HTTP/2. A TCP segment with a piece of a photo is lost. What happens to the CSS arriving after it on the same connection?

You turn on HTTP/3 on your server and its responses already carry alt-svc: h3. But in DevTools everything still shows h2, and the firewall only lets TCP through to port 443. What’s going on?

Your CDN starts speaking HTTP/2 with browsers. What do you have to change in your API’s routes and responses?

You’re walking down the street with a website open on your phone, and it switches from a café’s Wi-Fi to 4G. With which version can the same connection carry on?

phase-2 · lesson 8/8