DEV Community

Cover image for What Really Happens When You Type a URL and Press Enter?
Tanu Priya
Tanu Priya

Posted on

What Really Happens When You Type a URL and Press Enter?

You open your browser.

You type:

https://example.com
Enter fullscreen mode Exit fullscreen mode

Then you press Enter.

Within a few seconds, a webpage appears on your screen.

It feels like a single action.

But behind that Enter key is an entire chain of systems involving DNS, networking, TCP, TLS, HTTP, servers, databases, caching, and browser rendering.

So what actually happens between typing a URL and seeing a webpage?


The Big Picture

A simplified journey looks like this:

You Type a URL
      ↓
Browser Parses URL
      ↓
DNS Resolves Domain
      ↓
Connection Established
      ↓
TLS Encryption
      ↓
HTTP Request
      ↓
Web Server
      ↓
HTTP Response
      ↓
Browser Receives Resources
      ↓
HTML → CSS → JavaScript
      ↓
Page Rendered
Enter fullscreen mode Exit fullscreen mode

Let's follow this journey step by step.


1. You Type a URL

Suppose you enter:

https://example.com/products
Enter fullscreen mode Exit fullscreen mode

A URL contains several important components:

https://example.com/products
  │          │          │
Protocol   Domain      Path
Enter fullscreen mode Exit fullscreen mode

Protocol

https
Enter fullscreen mode Exit fullscreen mode

Defines how communication should happen.

Domain

example.com
Enter fullscreen mode Exit fullscreen mode

Identifies the website.

Path

/products
Enter fullscreen mode Exit fullscreen mode

Identifies the requested resource or route.

The browser parses this information before starting the network request.


2. The Browser Checks Its Cache

Before making a network request, the browser may check whether it already has useful information cached.

Caching can exist at several levels:

Browser Cache
     ↓
Operating System
     ↓
DNS Cache
     ↓
Network / CDN Cache
     ↓
Server
Enter fullscreen mode Exit fullscreen mode

If something can be reused safely, the browser may avoid downloading it again.

This is one of the reasons returning to a website can sometimes feel much faster.


3. DNS Finds the Server

Your browser knows the domain:

example.com
Enter fullscreen mode Exit fullscreen mode

But networks communicate using IP addresses.

So the browser needs to discover the appropriate IP address.

This is the job of DNS — Domain Name System.

Conceptually:

example.com
     ↓
DNS
     ↓
IP Address
Enter fullscreen mode Exit fullscreen mode

For example:

example.com
     ↓
93.xxx.xxx.xxx
Enter fullscreen mode Exit fullscreen mode

The actual address depends on the domain and DNS configuration.


4. DNS Is Like the Internet's Phone Book

Think about calling someone.

You know their name, but your phone needs their number.

DNS performs a similar translation:

Domain Name → IP Address
Enter fullscreen mode Exit fullscreen mode

Without DNS, users would have to remember IP addresses instead of convenient domain names.

Instead of:

https://example.com
Enter fullscreen mode Exit fullscreen mode

you would have to enter something like:

https://93.xxx.xxx.xxx
Enter fullscreen mode Exit fullscreen mode

DNS makes the internet much easier to use.


5. DNS Doesn't Always Start From Scratch

DNS results can be cached.

A simplified lookup might look like:

Browser Cache
     ↓
OS Cache
     ↓
DNS Resolver Cache
     ↓
Authoritative DNS Server
Enter fullscreen mode Exit fullscreen mode

If the required information is already cached and hasn't expired, the system may avoid performing the entire lookup again.

DNS records have a TTL (Time To Live) that helps determine how long cached information can be retained.

This is another example of how caching improves performance.


6. Your Browser Needs a Network Connection

Now your browser knows where the server is.

It needs to communicate with it.

For HTTPS, the connection generally involves modern transport networking such as TCP or QUIC, depending on the HTTP version and connection setup.

A simplified traditional HTTPS flow is:

Browser
   ↓
TCP Connection
   ↓
TLS
   ↓
HTTP
   ↓
Server
Enter fullscreen mode Exit fullscreen mode

Modern HTTP/3 uses QUIC, which runs over UDP and incorporates transport and security mechanisms differently.

The exact path depends on the protocol and browser/server capabilities.


7. TLS Secures the Connection

Because you're using:

https://
Enter fullscreen mode Exit fullscreen mode

the browser needs to establish a secure connection.

This involves TLS — Transport Layer Security.

Conceptually:

Browser
   │
   │ TLS Handshake
   ▼
Server
   │
   │ Secure Connection
   ▼
Encrypted HTTP Communication
Enter fullscreen mode Exit fullscreen mode

TLS helps provide:

  • Encryption
  • Authentication
  • Integrity

This helps prevent attackers on the network from simply reading or modifying the protected traffic.


8. The Browser Sends an HTTP Request

Now the browser can send the actual request.

A simplified HTTP request might look like:

GET /products HTTP/1.1
Host: example.com
Enter fullscreen mode Exit fullscreen mode

The browser is essentially saying:

"Please give me the /products resource from example.com."

The request can also contain headers such as:

User-Agent
Accept
Accept-Encoding
Cookie
Authorization
Enter fullscreen mode Exit fullscreen mode

These provide additional information to the server.


9. The Request Reaches the Server

The request travels through the internet:

Browser
   ↓
Router
   ↓
ISP
   ↓
Internet
   ↓
Load Balancer / CDN
   ↓
Web Server
Enter fullscreen mode Exit fullscreen mode

The server receiving the request may not be a single machine.

Large websites usually operate distributed infrastructure.

A simplified architecture might look like:

                 Users
                   ↓
             Load Balancer
                   ↓
        ┌──────────┼──────────┐
        ↓          ↓          ↓
     Server A   Server B   Server C
Enter fullscreen mode Exit fullscreen mode

The load balancer distributes requests across available infrastructure.


10. The Server Processes the Request

Now the backend needs to determine what response to return.

For example:

GET /products
Enter fullscreen mode Exit fullscreen mode

could be handled by an application server.

The backend might:

Receive Request
      ↓
Authenticate User
      ↓
Run Application Logic
      ↓
Query Database
      ↓
Prepare Response
Enter fullscreen mode Exit fullscreen mode

For a simple static website, the server may simply return a pre-generated HTML file.

For a dynamic application, it may need to execute backend code and access databases or other services.


11. The Database May Be Involved

Suppose you're opening:

/products
Enter fullscreen mode Exit fullscreen mode

The server may need product information.

Conceptually:

Browser
   ↓
Backend
   ↓
Database
   ↓
Product Data
   ↓
Backend
   ↓
HTTP Response
Enter fullscreen mode Exit fullscreen mode

The database might contain:

Product ID
Product Name
Price
Description
Image URL
Enter fullscreen mode Exit fullscreen mode

The backend uses this data to construct the response.


12. Caching Can Make This Faster

The server doesn't necessarily need to query the database for every request.

It can use caching.

For example:

Request
  ↓
Cache
  ├── HIT → Return Cached Data
  │
  └── MISS
       ↓
    Database
       ↓
    Store in Cache
       ↓
    Return Data
Enter fullscreen mode Exit fullscreen mode

This can significantly reduce database load and improve response times.

Caching is one of the most important performance techniques in web architecture.


13. The Server Sends an HTTP Response

After processing the request, the server sends a response.

A simplified response might look like:

HTTP/1.1 200 OK
Content-Type: text/html
Enter fullscreen mode Exit fullscreen mode

followed by the HTML content.

For example:

<html>
  <head>
    <title>My Website</title>
  </head>

  <body>
    <h1>Hello World</h1>
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode

The browser now has the first major piece of information it needs to construct the page.


14. What Does HTTP Status Code Mean?

The response contains a status code.

Common examples include:

200 → Success
301 → Permanent Redirect
302 → Temporary Redirect
304 → Not Modified
400 → Bad Request
401 → Unauthorized
403 → Forbidden
404 → Not Found
500 → Server Error
Enter fullscreen mode Exit fullscreen mode

For example:

GET /products
        ↓
HTTP 200 OK
Enter fullscreen mode Exit fullscreen mode

means the request was successfully processed.


15. HTML Is Only the Beginning

You might think:

"The browser received HTML, so the page is done."

Not yet.

The HTML can contain references to other resources:

<link rel="stylesheet" href="/style.css">

<script src="/app.js"></script>

<img src="/logo.png">
Enter fullscreen mode Exit fullscreen mode

Now the browser needs to request these resources too.

Conceptually:

HTML
 ↓
 ├── CSS
 ├── JavaScript
 ├── Images
 ├── Fonts
 └── Other Resources
Enter fullscreen mode Exit fullscreen mode

This can result in many additional network requests.


16. The Browser Builds the DOM

The browser parses the HTML and creates a structure called the DOM — Document Object Model.

For example:

<h1>Hello</h1>
<p>Welcome!</p>
Enter fullscreen mode Exit fullscreen mode

can conceptually become:

Document
 ├── h1
 │    └── "Hello"
 │
 └── p
      └── "Welcome!"
Enter fullscreen mode Exit fullscreen mode

The DOM represents the structure of the webpage.


17. CSS Creates the Visual Style

The browser also downloads and processes CSS.

For example:

h1 {
  font-size: 32px;
}
Enter fullscreen mode Exit fullscreen mode

The browser needs to determine:

  • Colors
  • Fonts
  • Sizes
  • Positions
  • Spacing
  • Layout

This information contributes to the visual representation of the page.


18. JavaScript Makes the Page Interactive

Modern websites often rely heavily on JavaScript.

JavaScript can:

  • Handle user interactions
  • Fetch additional data
  • Update the DOM
  • Validate forms
  • Communicate with APIs
  • Create animations
  • Manage application state

For example:

HTML
 ↓
JavaScript
 ↓
API Request
 ↓
Backend
 ↓
JSON Response
 ↓
Update UI
Enter fullscreen mode Exit fullscreen mode

This is why a webpage can continue making network requests even after the initial HTML has loaded.


19. The Browser Builds the Render Tree

The browser combines information from HTML and CSS to determine what should actually be displayed.

A simplified rendering process is:

HTML
 ↓
DOM
 ↓
CSS
 ↓
CSSOM
 ↓
Render Tree
 ↓
Layout
 ↓
Paint
 ↓
Composite
 ↓
Screen
Enter fullscreen mode Exit fullscreen mode

Layout

Determines where elements should appear.

Paint

Determines how pixels should be drawn.

Composite

Combines visual layers before displaying them.

The exact browser pipeline is more complex, but this is a useful mental model.


20. Then You Finally See the Page

After all of this:

URL
 ↓
DNS
 ↓
Connection
 ↓
TLS
 ↓
HTTP Request
 ↓
Server
 ↓
HTTP Response
 ↓
HTML
 ↓
CSS
 ↓
JavaScript
 ↓
Rendering
 ↓
Screen
Enter fullscreen mode Exit fullscreen mode

You finally see:

The webpage.

And this entire process can happen extremely quickly.


21. What If the Website Uses a CDN?

Large websites often use a Content Delivery Network (CDN).

Instead of:

User → Origin Server
Enter fullscreen mode Exit fullscreen mode

the architecture can look like:

User
 ↓
Nearby CDN
 ↓
Origin Server
Enter fullscreen mode Exit fullscreen mode

Static resources such as:

  • Images
  • CSS
  • JavaScript
  • Fonts
  • Videos

can often be cached at CDN locations.

This reduces latency and decreases the load on the origin infrastructure.


22. What If You Visit the Website Again?

The browser can reuse cached resources.

For example:

First Visit
   ↓
Download CSS
Download JS
Download Images
Enter fullscreen mode Exit fullscreen mode

Later:

Second Visit
   ↓
Check Cache
   ↓
Reuse Existing Resources
Enter fullscreen mode Exit fullscreen mode

The server can also use HTTP caching mechanisms such as:

Cache-Control
ETag
Last-Modified
Enter fullscreen mode Exit fullscreen mode

This allows browsers and intermediary caches to avoid downloading unchanged resources unnecessarily.


23. What If Something Goes Wrong?

Many things can fail.

For example:

DNS Failure
     ↓
Cannot find server
Enter fullscreen mode Exit fullscreen mode

Or:

TLS Failure
     ↓
Secure connection cannot be established
Enter fullscreen mode Exit fullscreen mode

Or:

404
     ↓
Resource doesn't exist
Enter fullscreen mode Exit fullscreen mode

Or:

500
     ↓
Server-side error
Enter fullscreen mode Exit fullscreen mode

Modern web systems therefore rely heavily on:

  • Redundancy
  • Load balancing
  • Caching
  • Monitoring
  • Retries
  • Timeouts
  • Failover
  • Fault tolerance

The goal isn't to assume that failures won't happen.

It's to design for failure.


The Complete Journey

Let's put everything together:

              You
               ↓
          Type URL
               ↓
        Browser Parses URL
               ↓
          DNS Resolution
               ↓
      TCP / QUIC Connection
               ↓
          TLS Handshake
               ↓
        HTTP Request
               ↓
      CDN / Load Balancer
               ↓
         Web Server
               ↓
      Application Logic
               ↓
          Database
               ↓
        HTTP Response
               ↓
             HTML
               ↓
        CSS / JavaScript
               ↓
       Browser Rendering
               ↓
             Screen
Enter fullscreen mode Exit fullscreen mode

A simple URL has triggered an entire chain of systems.


The System Design Concepts Behind a Web Request

Typing a URL is a great way to understand modern web architecture.

DNS

Converts domain names into network addresses.

TCP / QUIC

Provides the transport layer used for communication.

TLS

Provides secure communication over the network.

HTTP

Defines how clients and servers communicate.

Load Balancing

Distributes traffic across servers.

Databases

Store and retrieve structured application data.

Caching

Reduces repeated computation and data retrieval.

CDNs

Deliver content closer to users.

Backend Services

Process requests and implement application logic.

Browser Rendering

Transforms HTML, CSS, and JavaScript into the webpage you see.


Final Takeaway

When you type:

https://example.com
Enter fullscreen mode Exit fullscreen mode

and press Enter, your browser isn't simply "opening a website."

It's starting a chain of communication:

URL
 ↓
DNS
 ↓
Network
 ↓
TLS
 ↓
HTTP
 ↓
Server
 ↓
Database / Cache
 ↓
Response
 ↓
HTML
 ↓
CSS + JavaScript
 ↓
Browser Rendering
 ↓
Webpage
Enter fullscreen mode Exit fullscreen mode

What feels like one simple action actually involves multiple layers of the internet working together.

And that's what makes the web fascinating:

You type a URL. The internet does the rest.

Top comments (0)