Web Fundamentals

What Actually Happens When You Type a URL and Hit Enter

You type https://example.com and a page appears in milliseconds. Here's the full journey — DNS lookup, TCP connection, HTTP request, and browser rendering — explained clearly.

·7 min read·Samson Ameh
#Web#DNS#HTTP#Networking#Browser

What Actually Happens When You Type a URL and Hit Enter

You type https://example.com into your browser and hit Enter. Less than a second later, a fully rendered page is on your screen. That gap hides an entire sequence of network operations, protocol handshakes, and rendering steps. Here's what's actually happening.


Step 1: DNS finds the address

The browser has a name — example.com — but needs a number. Every device on the internet is identified by an IP address (like 93.184.216.34), not a human-readable name. The Domain Name System (DNS) is the directory that translates one into the other.

Here's the lookup chain:

  1. Browser cache — the browser first checks if it already looked up this domain recently and saved the result.
  2. OS cache — if not, it asks the operating system, which has its own cache.
  3. Router cache — if still not found, the query goes to your router.
  4. Recursive resolver — your ISP (or a public resolver like 1.1.1.1 or 8.8.8.8) handles the full lookup on your behalf.
  5. Root nameserver → TLD nameserver → Authoritative nameserver — the resolver works down the DNS hierarchy: first asking which server handles .com, then which server handles example.com, then getting the actual IP address from the authoritative nameserver for that domain.

The result — an IP address — comes back and is cached at each layer with a TTL (time to live) value set by the domain owner. The whole lookup typically takes 20–120ms on a first visit, often under 1ms on a cached repeat visit.

You can see this yourself by running:

Terminal
$nslookup example.com

Or with more detail:

Terminal
$dig example.com

The IANA DNS root zone database documents the full root server infrastructure behind this.


Step 2: The browser connects to the server

With an IP address in hand, the browser opens a TCP connection to the server. TCP (Transmission Control Protocol) is the transport layer that ensures data arrives reliably and in the right order.

The connection starts with a three-way handshake:

  1. SYN — the browser sends a "synchronise" packet to the server
  2. SYN-ACK — the server acknowledges and sends its own synchronise packet back
  3. ACK — the browser acknowledges the server's packet

This costs one round trip before any data is exchanged.

Because the URL starts with https://, there's an additional step: a TLS handshake. TLS (Transport Layer Security) is the protocol that encrypts the connection — it's what makes the padlock appear in your browser's address bar.

The TLS handshake involves:

  • The server sending its SSL/TLS certificate, which proves it is who it claims to be
  • The browser verifying that certificate against a trusted Certificate Authority (CA)
  • Both sides agreeing on an encryption key to use for this session

Modern browsers use TLS 1.3, which completes the handshake in one round trip instead of two, making HTTPS connections noticeably faster than older versions. You can read the full spec in RFC 8446.

The combined TCP + TLS setup cost is roughly 1–2 round trips. On a connection with 50ms latency (a reasonable estimate for many users), that's 50–100ms before the browser has even asked for the page.


Step 3: The browser sends an HTTP request

Once the connection is established, the browser sends an HTTP request — a formatted message that says "please give me this page."

A minimal request looks like this:

GET / HTTP/2
Host: example.com
User-Agent: Mozilla/5.0 ...
Accept: text/html,application/xhtml+xml,...
Accept-Language: en-US,en;q=0.9

Key parts:

  • Method — GET means "retrieve". Other methods like POST, PUT, and DELETE are used for other actions.
  • Path — / means the root of the site. A URL like /blog/post-1 would be the path instead.
  • Host — tells the server which domain is being requested (since one server can host many domains).
  • Headers — additional metadata about the request: what the browser accepts, what language it prefers, any cookies it's holding for this domain.

Modern browsers use HTTP/2 or HTTP/3 by default, which allow multiple requests to travel over the same connection simultaneously — a major improvement over HTTP/1.1, which only handled one request at a time per connection. HTTP/3 goes further by running over QUIC instead of TCP, reducing latency further on unreliable connections.


Step 4: The server sends the response

The server receives the request, processes it, and sends back an HTTP response.

A minimal response:

HTTP/2 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 1256
Cache-Control: max-age=3600

<!DOCTYPE html>
<html>
  <head>...</head>
  <body>...</body>
</html>

Key parts:

  • Status code — 200 OK means success. Other common codes: 301 (permanent redirect), 404 (not found), 500 (server error). The full list is documented by MDN.
  • Content-Type — tells the browser what kind of data is coming back. text/html means it's an HTML document.
  • Cache-Control — tells the browser whether and how long to cache this response locally.
  • Body — the actual HTML of the page.

The server might be a static file server, a Node.js/Express application, a CDN edge node, or any other software that understands HTTP. From the browser's perspective, it doesn't matter — it just needs a valid HTTP response.


Step 5: The browser builds the page

Once the HTML starts arriving (browsers begin parsing before the full response is received), the browser starts building what you see on screen. This involves four main sub-processes:

1. Parse HTML → build the DOM

The browser reads the HTML top to bottom and constructs the Document Object Model (DOM) — a tree structure representing every element on the page. When it encounters a <link> tag pointing to a CSS file or a <script> tag, it pauses and fetches those too (unless they're marked async or defer).

2. Parse CSS → build the CSSOM

Downloaded stylesheets are parsed into the CSS Object Model (CSSOM) — a parallel tree representing all the styles. The browser cannot render anything until the CSSOM is complete, because a style rule might affect any part of the page.

3. Combine → Render Tree

The DOM and CSSOM are combined into a Render Tree — only the visible elements, with their computed styles attached. Elements hidden with display: none are excluded entirely.

4. Layout → Paint → Composite

  • Layout (also called Reflow): the browser calculates the exact position and size of every element on screen.
  • Paint: the browser fills in pixels — colours, borders, shadows, text.
  • Composite: if there are layers (created by transform, opacity, position: fixed, etc.), the browser composites them together on the GPU before displaying the final frame.

This entire pipeline — parsing, layout, paint, composite — is what happens in the roughly 16ms budget each frame gets to hit 60 frames per second. The Chrome DevTools Performance panel lets you inspect every millisecond of this.


The full journey, summarised

StepWhat happensTypical time
DNS lookupDomain name → IP address1–120ms (cached: <1ms)
TCP handshakeEstablish reliable connection1 round trip (~50ms)
TLS handshakeEncrypt the connection1 round trip (TLS 1.3)
HTTP requestBrowser asks for the pageIncluded in above
Server responseHTML starts arrivingDepends on server
Parse & renderBrowser builds the page10–100ms

For a site like Google, the entire sequence completes in under 200ms. For a slow server on a high-latency connection, the same sequence can take several seconds — which is why each of these steps is a performance optimisation target.


Why this matters for web development

Understanding this pipeline explains a lot of common performance advice:

  • Use a CDN — puts the server physically closer to users, reducing round-trip time for every step after DNS
  • Enable HTTP/2 or HTTP/3 — eliminates head-of-line blocking so resources load in parallel
  • Set long Cache-Control headers on static assets — skips the entire request for repeat visitors
  • Defer non-critical JavaScript — stops the HTML parser from blocking on script downloads
  • Preload critical resources — tells the browser about resources it will need before it discovers them in the HTML
  • Use TLS 1.3 — cuts one round trip from the connection setup

Each optimisation targets a specific step in the journey above. When you understand the journey, the advice makes sense instead of feeling like a checklist.


Further reading

Written by

Samson Ameh

Frontend Engineer specialising in React, TypeScript, and enterprise UI systems. Based in Lagos, Nigeria.