How HTTP works

Follow a page request from your browser to the server and back.

The request–response cycle

  1. Look up example.org
    (Browser to DNS resolver)
  2. Return the IP address
    (DNS resolver to browser)
  3. Open a TCP connection and negotiate TLS
    (Browser and web server)
  4. GET /index.html + headers
    (Browser to web server)
  5. 200 OK + headers + HTML
    (Web server to browser)
  6. Request CSS and images
    (Browser to web server)
  7. Send a response for each file
    (Web server to browser)
A first visit over HTTPS using HTTP/1.1. Browsers can reuse saved files and open connections. Diagram sources

What happens when you enter a URL?

  1. Read the address

    The browser reads https://example.org/index.html as three parts. https is the scheme, example.org is the host, and /index.html is the path. [8]

  2. Look up the host

    If the browser has no usable cached address, it asks the Domain Name System (DNS) for the host’s IP address. [24]

  3. Open a secure connection

    In this HTTP/1.1 example, the browser opens a TCP connection, typically to port 443 for HTTPS. It then uses Transport Layer Security (TLS) to verify the server’s identity and set up encryption. [8], [25]

  4. Ask for the page

    The browser sends GET /index.html. The Host header names the site and Accept tells the server which formats the browser can use. [8]

  5. Read the response

    The server sends a status code, headers, and usually a body. Here, 200 OK reports success and Content-Type: text/html identifies the body as HTML. [8]

  6. Load styles and images

    The browser reads the HTML and finds links to files such as stylesheets and images. It requests any files it cannot reuse from its cache, then uses those responses to display the page. [8], [10]

Look inside an HTTP/1.1 exchange

Browser request
GET /index.html HTTP/1.1
      Host: example.org
      Accept: text/html

      
Server response
HTTP/1.1 200 OK
      Content-Type: text/html; charset=utf-8
      Connection: close

      <!doctype html>
      <html lang="en">…</html>

What HTTPS adds

TLS encrypts the messages and detects changes while they travel. The browser also checks the server’s certificate to verify that it covers the domain in the address bar. That protects a password on its way to the site. You still have to decide whether to trust the site itself. [8], [25]

HTTP/2 and HTTP/3 keep the same basic requests and responses while changing how they travel. HTTP/3 uses the QUIC transport protocol. As of November 2026, HTTP/3 is the latest standardized version. The draft titled HTTP/4 is an experimental proposal. [26], [27]

Reading the response status

Common HTTP response codes
Code Meaning Example
200 OK The server returns the requested page.
301 Moved Permanently The resource has moved to a new URL.
304 Not Modified A conditional request confirms the browser can reuse its cached copy.
403 Forbidden The server refuses to fulfill the request.
404 Not Found The server cannot find the resource or will not reveal it.
500 Internal Server Error An unexpected error stopped the server from completing the request.

Status definitions follow HTTP Semantics. [8]