DEV Community

Daniel | Frontend developer
Daniel | Frontend developer

Posted on

🧠 What Actually Happens When You Type a URL in Your Browser?

You open your browser, type in https://www.example.com, hit Enter… and a website appears. Easy, right?

But under the hood, your computer is doing a ton of work in just milliseconds. Let’s walk through what actually happens, step-by-step — without too much jargon, but enough for both devs and curious minds.


1. Your Browser Breaks Down the URL

When you hit Enter, your browser looks at the parts of the URL:

  • https → the protocol (says ā€œuse a secure connectionā€)
  • www.example.com → the domain (who you’re trying to reach)
  • /blog/article → the path (what you want from them)
  • ?search=javascript → optional query info

So far, no connection has been made. This is just the browser prepping for the real work.


2. 🌐 Finding the Website’s Address (DNS Lookup)

Your browser can’t just call ā€œwww.example.comā€ — it needs the website’s IP address, like 93.184.216.34.

Here’s how it finds it:

  1. Checks your computer’s memory (maybe you’ve been here before)
  2. Asks your Wi-Fi router
  3. If no one knows, it asks your ISP
  4. If needed, it travels all the way up to the ā€œrootā€ DNS servers to figure out where example.com lives

Eventually, it gets the answer: ā€œHere’s the IP. Go talk to this server.ā€

Think of it like looking up someone’s phone number before calling them.


3. šŸ”’ Connecting to the Server (TCP + TLS Handshake)

Now that your browser knows where to go, it says: ā€œHi server, can we talk?ā€

This happens in two parts:

  • TCP handshake: Like knocking on the door and confirming someone’s home.
  • TLS handshake: Because it’s HTTPS, your browser and the server agree on encryption so that no one can snoop on the conversation.

This all happens in milliseconds.


4. Sending the Request (GET)

Now your browser says:

ā€œHey www.example.com, I’d like the homepage please.ā€

This is a GET request — it's like asking a librarian for a specific book.


5. The Server Prepares the Response

On the other end, the server:

  • Sees your request
  • Runs some code (maybe using Node.js, Python, PHP, etc.)
  • Might ask a database for info
  • Then bundles everything into a response

It sends back something like:

HTTP/1.1 200 OK
Content-Type: text/html

<!DOCTYPE html>
<html>
  <head><title>Welcome</title></head>
  <body>Hello, visitor!</body>
</html>
Enter fullscreen mode Exit fullscreen mode

6. 🧠 The Browser Starts Building the Page

Once the browser receives that HTML:

  • It reads the HTML and builds the DOM (a structure of the page)
  • It fetches any linked CSS (for styles) and JavaScript (for behavior)
  • It puts everything together visually — fonts, colors, images, buttons
  • It runs any JavaScript (maybe interactive stuff like menus or sliders)

Now you're looking at a fully working website.


7. Behind the Scenes: Optimizations

Good websites do more than just respond. Developers can:

  • Use CDNs to deliver content faster around the world
  • Preload assets the browser will need soon
  • Compress files to speed up delivery
  • Lazy-load images so they load only when needed

All this makes things feel instant — even though there’s a ton happening.


TL;DR (Too Long; Didn’t Read)

When you type a URL and hit Enter:

  1. Your browser breaks down the URL
  2. It finds the IP address using DNS
  3. It connects securely to the server
  4. Sends a GET request
  5. The server builds a response
  6. Your browser builds and shows the page

All in a blink. ⚔


Understanding this process is super helpful — whether you're a web developer or just someone curious about how the internet works. It’s a modern magic trick, made of real tech.

šŸ™‹ā€ā™‚ļø Enjoyed this post? Follow me on Twitter for more dev tips and threads!

Top comments (0)