Skip to content
5 min read

What Happens When You Type a URL in Your Browser?

Follow the complete journey of a URL from your keyboard to a loaded web page. Learn how browsers work — DNS, TCP, HTTP requests, rendering — in a clear, beginner-friendly walkthrough.

#webdevelopment #browsers #beginner #networking

“What happens when you type a URL in your browser?” is one of the most famous interview questions in software engineering. More importantly, understanding how browsers work gives you a mental model for debugging every web problem you’ll ever encounter.

Step 1: You Press Enter

The browser has the URL: https://kaiko.dev/blog. Let’s trace every step.

Step 2: DNS Lookup

The browser doesn’t know where kaiko.dev is. It checks:

  1. Its own DNS cache
  2. The OS DNS cache
  3. Your ISP’s recursive resolver
  4. Up the chain to authoritative nameservers

Result: an IP address like 76.76.21.21.

Step 3: TCP Connection

The browser opens a TCP connection to the server at that IP on port 443 (HTTPS). This involves a three-way handshake:

  1. Client → Server: “SYN” (I want to connect)
  2. Server → Client: “SYN-ACK” (Acknowledged, I’m ready)
  3. Client → Server: “ACK” (Great, let’s go)

For HTTPS, a TLS handshake follows to establish encryption.

Step 4: HTTP Request

The browser sends an HTTP GET request:

GET /blog HTTP/1.1
Host: kaiko.dev
Accept: text/html
User-Agent: Chrome/120

Step 5: Server Responds

The server receives the request, processes it (runs code, queries a database if needed), and sends back an HTTP response:

HTTP/1.1 200 OK
Content-Type: text/html
Cache-Control: max-age=3600

<!DOCTYPE html>...

Step 6: The Browser Renders the Page

The browser receives the HTML and starts parsing:

  1. HTML is parsed into a DOM tree
  2. CSS files are fetched, parsed into a CSSOM
  3. DOM + CSSOM = Render Tree
  4. Layout — calculate size and position of each element
  5. Paint — draw pixels to the screen

JavaScript files are downloaded and executed, potentially modifying the DOM and triggering re-renders.

Why This Matters

Understanding this flow explains:

  • Why DNS changes take time (caches have TTLs)
  • Why HTTPS matters (step 3 encrypts the connection)
  • Why large JavaScript files slow page loads (step 6 blocks rendering)
  • Why a 404 means the server responded but didn’t find the resource

Conclusion

The next time you hit a slow page or a broken site, walk through these steps. Is it a DNS issue? A slow server response? A large JavaScript bundle? Understanding how browsers work gives you the vocabulary to diagnose and fix problems that would otherwise feel mysterious.

Read next: How HTTP Works

External resource: Web.dev — How Browsers Work

Kaikobud Sarkar

Kaikobud Sarkar

Software engineer passionate about backend technologies and continuous learning. I write about Python frameworks, cloud architecture, engineering growth, and staying current in tech.

Related Articles

CSS Flexbox in Plain English: A Beginner's Guide

Learn CSS Flexbox with simple, visual explanations. This guide covers display flex, justify-content, align-items, flex-wrap, and practical layouts every developer needs to know.

#css #flexbox