DEV Community

Cover image for What Actually Happens When You Press Enter on a URL?
ELIZABETH ATIENO
ELIZABETH ATIENO

Posted on

What Actually Happens When You Press Enter on a URL?

You open your browser, type a URL, and press Enter within a few milliseconds, a website appears on your screen.

But behind that simple action is a complex chain of events happening across the globe: servers communicating, routers forwarding packets, DNS translating names into numbers, and encrypted connections securing your data.

Every time you visit a website, your request might travel through dozens of networks, multiple countries, and thousands of miles of fiber-optic cables before the response returns to your device.

So what really happens when you load a website?

1. The Internet Is a Network of Networks

At its core, the internet is simply a massive global network of interconnected computers.
These networks include:

  • Home networks
  • Corporate networks
  • Data centers
  • Internet Service Providers (ISPs)
  • Global backbone infrastructure

Each device connected to the internet is identified by something called an IP address.
Example:
142.250.190.78

This number uniquely identifies a device on the internet, similar to how a home address identifies a house.

2. Domain Names vs IP Addresses

Humans aren’t good at remembering numbers. Instead of typing an IP address, we use domain names like:
google.com
github.com
dev.to

So how does your computer know the IP address of a domain?
This is where DNS (Domain Name System) comes in it works like the phonebook of the internet.

Example process:
User enters: dev.to

Browser asks DNS server

DNS returns: 151.101.1.195

Browser connects to that server

3. What Happens When You Enter a URL

Let’s say you visit:
https://dev.to

Several things happen behind the scenes.
Step 1 — DNS Lookup

Your browser asks a DNS resolver:
“What is the IP address for dev.to?”

The resolver returns the server’s IP.

Step 2 — TCP Connection

Your browser establishes a connection to the server using TCP (Transmission Control Protocol).

TCP ensures:

  • Data arrives
  • Data arrives in order
  • Missing packets are retransmitted

This step is often called the TCP handshake.

Step 3 — HTTPS Encryption

If the site uses HTTPS (most do), the browser performs a TLS handshake.

This step:

  • Verifies the server’s identity
  • Establishes encryption
  • Protects the data being transmitted

Now your communication is secure.

Step 4 — HTTP Request

Your browser sends a request like this:

GET / HTTP/1.1
Host: dev.to

This is the HTTP protocol, which defines how browsers and servers communicate.

Step 5 — Server Response

The server processes the request and sends back a response:

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

Along with the HTML of the webpage.

Your browser then:

  • Parses the HTML
  • Downloads CSS
  • Downloads JavaScript
  • Renders the page
  • And the website appears on your screen.

4. How Data Travels Across the Internet

Data doesn’t travel as one big chunk. Instead, it is broken into small packets.

Each packet contains:

  • Source IP
  • Destination IP
  • Data payload
  • Packet number

Routers across the internet decide the best path for each packet to reach its destination.

Think of it like sending multiple envelopes through different postal routes that all arrive at the same house.

5. The Role of Servers and Data Centers

Websites live on servers inside data centers.

These servers run software like:

  • Web servers (Nginx, Apache)
  • Application servers
  • Databases

Large companies operate massive data centers around the world to ensure:

  • High availability
  • Low latency
  • Redundancy

6. CDNs Make the Internet Faster

To make websites load faster globally, companies use Content Delivery Networks (CDNs).

A CDN stores cached copies of content in servers located around the world.

Instead of requesting a file from a server in another continent, you may receive it from a nearby edge server.

This dramatically reduces latency.

7. A Simplified Flow

Here’s the entire process summarized:

  1. User enters URL
  2. DNS finds IP address
  3. Browser establishes TCP connection
  4. TLS handshake secures connection
  5. Browser sends HTTP request
  6. Server sends HTTP response
  7. Browser renders the webpage

All of this typically happens in milliseconds.

Final Thoughts

The internet may seem complex, but at its core it’s built on a few fundamental ideas:

  • IP addresses identify devices
  • DNS maps names to IPs
  • TCP ensures reliable data delivery
  • HTTP allows browsers and servers to communicate

Understanding these layers helps developers:

  • Debug networking issues
  • Optimize performance
  • Build better distributed systems And once you see the mechanics behind it, the internet becomes a lot less mysterious.

Top comments (0)