---
topic: web-performance
author: Crashtech Editorial
published: Nov 13, 2026 · read: 3 min
---

From Enter Key to Pixels: What Happens When You Type a URL

DNS caches, TCP, TLS, HTTP, then HTML parsing, the render tree, layout and paint. Every stage is a place a page can be slow, and a place to fix it.

– –

This is the classic interview question, and the reason it never dies is that it is the best map of web performance there is. Every millisecond a user waits belongs to one of about eight stages. Know the stages and “the site is slow” becomes a diagnosis instead of a complaint.

Stage 1 to 3: find the server and connect

  1. DNS lookup

    The browser needs an IP address for the hostname. It checks its own cache, then the OS cache, then a local resolver or router, then the ISP resolver. If nothing has it, the resolver walks the hierarchy: root servers point to the top-level domain servers, which point to the domain’s authoritative servers, which return the answer. Each answer carries a TTL that says how long it may be cached.

  2. TCP connection

    With an IP, the browser opens a TCP connection using the three-way handshake (SYN, SYN-ACK, ACK). That costs one round trip before any data moves.

  3. TLS handshake

    For HTTPS, client and server then negotiate encryption: the server proves its identity with a certificate, both sides agree on keys, and the rest of the conversation is encrypted. Modern TLS adds roughly one more round trip.

Stage 4: request and response

The browser sends an HTTP request. The server processes it (this is where your backend, database and cache time lives) and returns a response, usually a 200 with HTML. The time until the first byte of that response arrives is the time to first byte, a combination of everything so far plus your server’s work.

Stage 5 to 8: turn bytes into pixels

Parse HTML into the DOM structure
The browser parses HTML incrementally into a tree of elements. When it meets a stylesheet, image or script, it starts fetching those resources.
Parse CSS into the CSSOM styles
Stylesheets become a tree of style rules. Rendering waits for this, which is why CSS is render-blocking.
Build the render tree and lay out geometry
DOM plus CSSOM combine into a render tree containing only visible elements. Layout then computes each box’s size and position.
Paint and composite pixels
The browser paints boxes into layers and composites them to the screen. Scripts that change layout force this work to run again.
Where JavaScript hurts

A synchronous script can block HTML parsing, because it may modify the document. Scripts also wait for pending stylesheets. Use defer or async for non-critical scripts so parsing and rendering are not held hostage.

Advertisement

A stage-by-stage speed map

StageTypical symptomCommon fix
DNSSlow first visit onlyLonger TTLs, DNS prefetch, a faster resolver
TCP + TLSHigh latency to originCDN close to users, connection reuse, TLS 1.3, preconnect
Server timeLarge time to first byteCaching, query tuning, edge rendering
DownloadBig HTML, CSS, JSCompression, smaller bundles, HTTP/2 or HTTP/3
CSSOMBlank screen until styles loadInline critical CSS, trim unused CSS
ScriptsLate interactivitydefer, code splitting, remove third-party bloat
Layout/paintJank on scroll or resizeAvoid layout thrash, animate transform and opacity

Do

Measure which stage is slow before optimizing: look at the network waterfall and the performance panel, and fix the biggest block first.

Don't

Minify JavaScript while your time to first byte is two seconds. The page is waiting on your server, not your bundle.

Takeaway

A page load is a relay: name lookup, connection, encryption, request, response, parse, style, layout, paint. Each leg hands off to the next, and the user feels the sum. Learn to see which leg is slow and you know where to look.

Advertisement

Frequently asked questions

Why is the first request to a site slower than the next?

The first visit pays for DNS resolution, a TCP connection, and a TLS handshake before any HTTP byte moves. Later requests reuse cached DNS answers and often an open connection, so they skip most of that setup. That is why connection reuse and preconnect hints help real-world load times.

What is the difference between the DOM and the render tree?

The DOM is the tree of all elements parsed from HTML. The render tree combines the DOM with computed styles from the CSSOM and includes only what is actually displayed. Elements with display none are in the DOM but not in the render tree.

Why do render-blocking CSS and JavaScript slow the page?

The browser cannot paint until it has both the DOM and CSSOM, so stylesheets block rendering. A synchronous script can block HTML parsing itself, because it might change the document. Deferring scripts and inlining critical CSS shortens the time to first paint.

Where does DNS caching happen?

At several layers: the browser, the operating system, a local resolver or router, and the ISP's recursive resolver. Only if every layer misses does a recursive lookup go out through root, top-level domain and authoritative servers. Each answer carries a time-to-live that says how long it may be cached.

Sources & further reading

/* Comments */