What Really Happens When You Type a URL? A Step‑by‑Step Journey from DNS to Rendering
This article walks through the complete browser workflow—from entering a URL and resolving it via DNS caches and recursive lookup, through establishing a secure HTTPS connection with TCP handshakes and key exchange, to the server's response and the browser's rendering process.
Step 1 – URL to IP address (DNS resolution)
When a user enters a URL (e.g., www.example.com) the browser attempts to resolve the hostname to an IPv4/IPv6 address. It checks, in order:
Browser’s own DNS cache
Operating‑system resolver cache (e.g., /etc/hosts and nscd)
Local network cache (router/DHCP)
ISP recursive resolver cache
If none of these caches contain a valid record, the browser sends a DNS query to the configured recursive resolver, which performs a recursive lookup through the DNS hierarchy (root → TLD → authoritative name server) to obtain an A or AAAA record.
Step 2 – Recursive DNS lookup details
The recursive resolver starts at a root server, receives the list of authoritative name servers for the top‑level domain (e.g., .com), then queries the TLD server for the domain’s authoritative server, and finally queries that server for the final address record. The resolver caches the result according to the record’s TTL before returning it to the client.
Step 3 – Establishing a secure HTTPS connection
With the IP address known, the browser opens a TCP connection to port 443 and performs the TLS handshake:
TCP three‑way handshake (SYN, SYN‑ACK, ACK).
Client sends ClientHello with supported TLS version, cipher suites, and a random nonce.
Server replies with ServerHello, selects a cipher suite, and sends its X.509 certificate containing the public key.
Client validates the certificate chain (trusted root, hostname match, expiration).
Client generates a pre‑master secret, encrypts it with the server’s public key, and sends it in ClientKeyExchange.
Both sides derive the symmetric session keys from the pre‑master secret and exchanged nonces.
Handshake finishes with Finished messages, after which application data is encrypted with the symmetric keys.
All subsequent HTTP requests and responses are sent over this encrypted channel (HTTPS).
Step 4 – Server response and browser rendering pipeline
The server processes the HTTP request and returns an HTTP response, typically with status code 200 OK and a payload consisting of HTML, CSS, and JavaScript.
The browser rendering pipeline proceeds as follows:
HTML parser builds the Document Object Model (DOM) tree.
CSS parser builds the CSS Object Model (CSSOM) tree.
DOM and CSSOM are merged into a render tree that contains only visible elements and computed styles.
Layout (reflow) calculates the geometry of each node.
Paint phase rasterizes each node onto layers, which are then composited to produce the final bitmap displayed to the user.
During this process the browser may also fetch additional resources (images, fonts, sub‑resources) and execute JavaScript, which can modify the DOM and trigger further layout or paint cycles.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
