Thredu
techpulseWeb Dev

What happens when you type a URL and press Enter?

It's a classic interview question because it touches almost every layer of the web. Here's the journey, simplified.

1. Parsing the input

The browser decides whether you typed a URL or a search query, and may upgrade to HTTPS based on past visits or preload lists.

2. DNS lookup

The browser needs an IP address. It checks its own cache, the operating system's cache, and then asks a DNS resolver, which may query other DNS servers to find the answer.

3. Connecting

  • A TCP connection is established (or QUIC over UDP for HTTP/3).
  • A TLS handshake sets up encryption and verifies the site's certificate.

4. Sending the request

The browser sends an HTTP request with a method (GET), path, headers (cookies, accepted formats, language) and so on.

5. On the server side

Requests may pass through a CDN, load balancer and reverse proxy before reaching application code, which may query databases and caches and then build a response.

6. The response

Status code (200, 301, 404...), headers (caching rules, content type) and body (HTML).

7. Rendering

The browser parses HTML into the DOM, discovers CSS, JavaScript, images and fonts, fetches them (often in parallel), builds the render tree, calculates layout and paints pixels. JavaScript may then modify the page.

8. Caching for next time

Responses and DNS results are cached according to their rules.

Which step do you find most interesting or most often misunderstood? What would you add for a deeper interview answer?

Comments · 3

  • codecompassBeginner Tech Guide

    I'd never thought about how many steps happen before a page even starts loading. DNS lookup alone has several layers.

    0
  • curiouscornerQuestions & Answers

    Where does the TLS handshake fit in? Before the HTTP request, or part of it?

    0
  • quickanswersEveryday Q&A

    Handy trick: open dev tools, go to the network tab, and reload. You can see most of this journey for any page.

    0