All posts

Blog

HTTP/2 vs HTTP/3: What They Are and Why They Make Websites Faster

Illustrated cover for the Speed & Performance guide "HTTP/2 vs HTTP/3: What They Are and Why They Make Websites Faster"

Most website speed advice is about making things smaller: smaller images, smaller scripts, fewer plugins. But the way data travels between the server and the browser matters too. The protocol that handles that conversation is HTTP, and it has had two major upgrades in the past decade: HTTP/2 and HTTP/3.

You don't have to rewrite your site to benefit from them. You mostly need to know they exist, check that they are switched on, and drop a few old habits that no longer help. Here is the plain-English version.

A quick look back: HTTP/1.1

HTTP/1.1 was standardized in the late 1990s and served the web for a very long time. Its main limitation is that each connection can effectively handle one request at a time. A browser that needs 60 files for a page has to queue them up.

To work around this, browsers open several connections per domain (commonly up to six), and developers invented tricks:

  • Concatenation: combining many CSS or JavaScript files into one
  • Image sprites: merging many small images into one big image
  • Domain sharding: splitting files across several subdomains to get more connections

These tricks helped, but they were workarounds for a protocol limitation.

What HTTP/2 changed

HTTP/2 was published in 2015 (RFC 7540, later updated by RFC 9113). It keeps the same meaning of requests and responses (methods, status codes, headers) but changes how they travel.

Multiplexing

The headline feature. Many requests and responses share a single connection at the same time, interleaved as small frames. The browser no longer has to wait for one file to finish before asking for the next.

Header compression

HTTP headers repeat a lot of the same information on every request: cookies, user agent, accepted formats. HTTP/2 compresses headers with a scheme called HPACK, cutting overhead.

Binary framing

HTTP/1.1 is plain text. HTTP/2 uses a binary format that is more efficient for machines to parse.

Server push (mostly gone)

HTTP/2 included "server push," which let servers send files before the browser asked. In practice it was hard to use well, and major browsers including Chrome have removed support. You can safely ignore it.

HTTPS in practice

The HTTP/2 standard doesn't strictly require encryption, but browsers only support it over HTTPS. If your site isn't on HTTPS yet, start with our guide on what SSL and HTTPS are.

The problem HTTP/2 didn't solve

HTTP/2 runs on TCP, the reliable transport protocol underneath most of the internet. TCP delivers data strictly in order. If a single packet is lost, everything behind it waits until that packet is resent, even data belonging to completely different files. This is called head-of-line blocking at the transport level.

On a fast, stable connection you'll rarely notice. On a patchy mobile network, packet loss is common, and one lost packet can stall every file sharing that connection.

What HTTP/3 changed

HTTP/3 (RFC 9114, published in 2022) keeps the same HTTP semantics again, but replaces TCP with QUIC, a transport protocol built on top of UDP.

Independent streams

QUIC handles each stream separately. A lost packet only delays the stream it belongs to; other files keep flowing. This directly addresses the head-of-line problem.

Faster connection setup

With TCP plus TLS, setting up a secure connection takes several round trips before any data flows. QUIC builds encryption (TLS 1.3) into the transport and combines the handshakes, so connections start faster. For returning visitors it can even send data in the very first round trip in some cases.

Connection migration

A QUIC connection is identified by a connection ID rather than by IP address and port. When a phone switches from Wi-Fi to cellular, the connection can continue instead of starting over.

Always encrypted

Encryption is mandatory and built in. There is no unencrypted HTTP/3.

HTTP/2 vs HTTP/3 at a glance

HTTP/1.1 HTTP/2 HTTP/3
Transport TCP TCP QUIC over UDP
Multiple requests per connection Limited Yes Yes
Header compression No HPACK QPACK
Head-of-line blocking Yes At TCP level Largely avoided
Encryption Optional Required by browsers Always

Will HTTP/3 make my site faster?

It depends on your visitors. The biggest benefits show up on:

  • Mobile networks and weaker connections with packet loss
  • Visitors far from your server (more latency means handshakes cost more)
  • Pages that load many resources

On a fast wired connection to a nearby server, the difference between HTTP/2 and HTTP/3 may be small. There is little downside, though: browsers try HTTP/3 when the server advertises it and fall back to HTTP/2 if it fails, for example on networks that block UDP.

How to check which version your site uses

Browser developer tools: 1. Open your site and press F12. 2. Go to the Network tab and reload. 3. Right-click the column headers and enable "Protocol." 4. You'll see http/1.1, h2 or h3 for each request.

The first visit may show h2 even on an HTTP/3-capable server, because the browser learns about HTTP/3 from an alt-svc response header and switches on later requests.

Command line: a recent curl build can test with curl -I --http2 https://example.com or curl -I --http3 https://example.com if it was compiled with HTTP/3 support.

How to enable HTTP/2 and HTTP/3

  • Shared hosting: many modern hosts already serve HTTP/2, and LiteSpeed servers support HTTP/3. Check with your host if you don't see it.
  • CDN: services like Cloudflare can serve HTTP/3 to visitors at the edge regardless of what your origin server supports, often with a single toggle.
  • Your own server: Nginx, Apache (via mod_http2), LiteSpeed and Caddy support HTTP/2. HTTP/3 support is available in LiteSpeed, Caddy and newer Nginx versions; you'll also need to open UDP port 443 in your firewall.

Old habits to drop

With HTTP/2 or HTTP/3, some HTTP/1.1-era tricks stop helping and can hurt:

  • Domain sharding adds extra DNS lookups and connections. Serve assets from as few origins as possible.
  • Aggressive bundling into one giant file means a small change invalidates the whole cache. Moderate bundling is still fine, but you don't need to merge everything.
  • Image sprites are rarely worth the complexity now.

Wrapping up

HTTP/2 lets many files share one connection efficiently. HTTP/3 goes further by moving to QUIC, which handles packet loss and network changes far more gracefully and connects faster. Both are invisible to visitors, need no code changes, and are increasingly on by default. Check what your site uses, turn on HTTP/3 if you can, and retire the old workarounds you no longer need.