Skip to content
Shubham JangleResources
Networking

Explore topics

HTTP vs HTTPS, and HTTP/1.1 vs HTTP/2 vs HTTP/3

HTTP vs HTTPS, and HTTP/1.1 vs HTTP/2 vs HTTP/3

  • Browsers show "Not Secure" for some sites and a secure connection (lock or settings icon) for others. That's the difference between HTTP and HTTPS.
  • Separately, HTTP has versions (HTTP/1.1, HTTP/2, HTTP/3) that mainly improve how efficiently data is transferred.

HTTP

  • HTTP (HyperText Transfer Protocol) is a set of rules for how a browser (client) and a server exchange requests and responses.
GET /products/42 HTTP/1.1
Host: shop.example.com
Accept: text/html
  • Plain HTTP sends data unencrypted, by default on port 80.
  • Anyone on the network path, like someone on public Wi-Fi, a compromised router, or a malicious network operator, can read and even modify the traffic, including passwords, cookies, and form data.
  • That's why browsers mark HTTP pages as Not Secure.

HTTPS

  • HTTPS is HTTP sent over TLS (Transport Layer Security). The "S" stands for Secure. It uses port 443 by default.
  • TLS provides three guarantees:
    • Encryption: others can't read the data in transit.
    • Integrity: data can't be modified in transit without detection.
    • Authentication: the server proves its identity with a certificate signed by a trusted Certificate Authority (CA), so you know you're talking to the real bank.com.
  • Before any HTTP data is sent, the browser and server perform a TLS handshake: they agree on encryption settings, the server presents its certificate, and both sides derive shared session keys. TLS 1.3 completes this in one round trip.
  • What HTTPS doesn't hide: the server's IP address, usually the domain name you're visiting, and the timing and size of traffic. It also doesn't make a website itself trustworthy; phishing sites can have valid certificates too.
  • HSTS (HTTP Strict Transport Security) tells the browser to always use HTTPS for a site, preventing downgrade attacks.
  • Certificates are free and automated today (for example, Let's Encrypt), so every site should use HTTPS.

HTTP versions

  • HTTP/1.1, HTTP/2, and HTTP/3 keep the same meaning: methods, URLs, headers, and status codes work the same way.
  • They differ in how messages are sent over the network.

HTTP/1.1

  • Uses TCP, and sends requests and headers as human-readable text.
  • Connections can be reused (keep-alive), but a connection handles one request at a time: the next response can't be sent until the current one finishes.
  • If the first request is slow, the requests behind it must wait. This is Head-of-Line (HOL) Blocking at the application level.
  • To fetch resources in parallel, browsers open multiple TCP connections, typically up to 6 per domain. Each connection has its own handshake cost.
  • Developers worked around these limits with tricks like bundling files, image sprites, and spreading assets across multiple domains.

HTTP/2

  • Introduced binary framing and multiplexing (standardized in 2015).
  • Binary framing: requests and responses are split into small binary frames, and each frame is tagged with the stream it belongs to. Images, scripts, CSS, and API calls each get their own stream.
  • Multiplexing: frames from many streams are interleaved over a single TCP connection, so multiple requests and responses transfer simultaneously without waiting for each other. This solves HTTP/1.1's application-level HOL blocking.
  • Header compression (HPACK) removes repeated headers like cookies and user agents.
  • The remaining problem: TCP-level HOL blocking. TCP delivers bytes strictly in order. If one TCP packet is lost, all streams on that connection wait until it's retransmitted, even streams whose data already arrived. On lossy networks like mobile, this can make HTTP/2 slower than expected.
  • HTTP/2 "server push" was rarely useful and has been removed from major browsers.

HTTP/3

  • Solves TCP-level HOL blocking using QUIC, a transport protocol built on UDP (standardized in 2022).
  • Independent streams: QUIC handles loss per stream. If a packet for one stream is lost, other streams keep receiving data.
  • TLS 1.3 is built in: encryption is part of the transport, and the connection and encryption handshakes are combined, so a new connection is usually ready in one round trip. A returning client can sometimes send data immediately (0-RTT).
  • Connection migration: QUIC identifies connections by ID rather than by IP address and port, so a download can continue when your phone switches from Wi-Fi to mobile data.
  • Browsers discover HTTP/3 support through an Alt-Svc header or DNS record, and fall back to HTTP/2 when a network blocks UDP.

Comparison

HTTP/1.1HTTP/2HTTP/3
TransportTCPTCPQUIC over UDP
Message formatTextBinary framesBinary frames
Requests per connectionOne at a timeMany, multiplexedMany, multiplexed
Head-of-line blockingApplication and TCP levelTCP level onlyOnly within the affected stream
Header compressionNoneHPACKQPACK
EncryptionOptional (HTTPS)Required by browsersAlways (TLS 1.3 built in)
Connection setupTCP + TLS handshakesTCP + TLS handshakesCombined, usually 1 RTT

Check it yourself

  • In Chrome DevTools, open the Network tab, right-click the column header, and enable Protocol. You'll see http/1.1, h2, or h3 for each request.
  • Click the site settings icon in the address bar to view the site's certificate.

Summary

  • HTTP vs HTTPS: HTTPS is HTTP over TLS, adding encryption, integrity, and server authentication.
  • HTTP/1.1: text-based, one request at a time per connection.
  • HTTP/2: binary framing and multiplexing over one TCP connection.
  • HTTP/3: independent streams over QUIC, with TLS 1.3 built in.

References