When you type a URL in the browser and press Enter, the browser resolves the domain name to an IP address with DNS, opens a TCP and TLS connection to the server, sends an HTTP request, receives the HTML response and renders the page. Each step usually takes only milliseconds. This is one of the most common web interview questions because it touches every layer of the web.
This guide follows the request from the address bar to the finished page, in order.
The browser first decides whether your text is a URL or a search term. If it is a URL, it splits it into scheme, host, port, path and query. For https://www.example.com/blog, the scheme is https, the host is www.example.com and the path is /blog. If the site is on the browser's HSTS list, an http address is upgraded to https before anything is sent.
Before using the network, the browser looks for a stored copy of the page. If a cached response is still fresh according to its caching headers, it can be shown immediately with no request. Otherwise the browser continues, and may later ask the server whether the cached copy is still valid.
The browser needs the server's IP address. It checks its own cache, then the operating system cache, then asks a recursive DNS resolver, which may walk from the root servers to the TLD servers to the domain's authoritative servers. The answer is an IPv4 or IPv6 address, such as 93.184.215.14, which is cached for the record's TTL.
With the address known, the browser connects to the server on port 443 (for https) or 80 (for http). TCP sets up a reliable connection with a three-way handshake:
SYN.SYN-ACK.ACK, and the connection is open.Modern browsers can instead use HTTP/3, which runs over QUIC on UDP and combines connection and encryption setup into fewer round trips.
For https, the client and server perform a TLS handshake. The server presents a certificate, the browser checks that it is valid, trusted and issued for this domain, and both sides agree on keys. After this, everything sent is encrypted, so others on the network cannot read or change it.
The browser sends an HTTP request through the secure connection:
The server, which may be a web server in front of an application and a database, builds a response:
The status code tells the result: 200 for success, 301 or 302 for a redirect to another URL, 404 for not found and 500 for a server error. On a redirect the browser repeats the steps for the new address.
The browser reads the HTML and builds the DOM, a tree of elements. It finds more resources, such as CSS, JavaScript and images, and requests them, often over the same connection. It builds the CSSOM from the CSS, combines both into a render tree, calculates the layout and paints pixels on the screen. JavaScript can then change the DOM and trigger more rendering.
Browsers reuse work to save time. DNS answers are cached for their TTL, and an open connection can carry several requests, so later pages skip the handshakes. Static files such as images, CSS and scripts are stored in the HTTP cache, so only changed files are downloaded again. Servers also compress responses with gzip or Brotli, which reduces the bytes sent.
| Step | What happens | Main technology |
|---|---|---|
| 1 | Parse the URL | Browser |
| 2 | Look for cached copy | HTTP cache |
| 3 | Find the IP address | DNS |
| 4 | Open a connection | TCP or QUIC |
| 5 | Encrypt the connection | TLS |
| 6 | Request and receive HTML | HTTP |
| 7 | Build and show the page | DOM, CSS, JavaScript |
Open the browser developer tools, go to the Network tab and reload. Click a request and open Timing to see DNS lookup, connection, TLS and waiting time separately.
The browser shows an error such as "server not found", because it cannot get an address to connect to.
No. It may return a redirect, an error, JSON or an HTML shell that JavaScript fills in later.
The first visit needs DNS and connection setup and downloads every file. Later visits reuse cached DNS answers, files and sometimes connections.
Pressing Enter starts a chain: parse the URL, check caches, resolve DNS, open TCP or QUIC, secure it with TLS, send an HTTP request, receive the response and render the HTML, CSS and JavaScript. Being able to name these steps in order, and say what each one does, is the expected answer in interviews.