What Happens When You Type a URL in a Browser?
The journey from typing a web address to seeing a page: DNS, connection, TLS, HTTP and rendering.
TL;DR
- When you press Enter, your browser looks up the site's address (DNS), opens a connection (TCP), sets up encryption (TLS), asks for the page (HTTP), then builds and draws it (rendering) [1].
- Most of this takes a fraction of a second, because browsers reuse and cache a lot.
- Each step needs back-and-forth trips over the network, which is why distance and slow connections feel slow.
The five steps #
A URL such as https://example.com/page contains the protocol (https), the host name (example.com) and the path (/page). Computers do not find sites by name, so the browser has to turn that name into a route to a real machine and then ask it for the page. The diagram shows the order.
Step 1: Finding the server with DNS #
The browser needs a numeric IP address. It first checks its own saved answers. If it does not know, it asks the Domain Name System (DNS), which maps friendly names like mozilla.org to addresses [3]. Think of looking up a name in a phone book to get a number. Every separate host name used by a page, such as fonts or scripts from other sites, needs its own lookup [1].
Step 2: Opening a connection (TCP) #
With the address, the browser opens a connection to the server using a three-part handshake, a short exchange to agree how the two sides will talk before any real request is sent [1]. HTTP normally runs on top of this kind of reliable connection [2].
Step 3: Setting up encryption (TLS) #
For an https address the two sides also agree how to encrypt the conversation, and the browser checks the server's identity. This takes extra round trips [1]. Newer setups can shorten the process, but the idea is the same: a private channel before any page data moves.
Step 4: Asking for the page (HTTP) #
Now the browser sends a request. In plain terms it says "please GET this page", plus a few details in headers. The server answers with a status code, such as 200 for success, headers and usually the HTML of the page [2].
| Part | Example |
|---|---|
| Request | GET the page at /page from example.com |
| Response status | 200 means OK, 404 means not found |
| Response body | The HTML, sent back to the browser |
Step 5: Turning code into a page #
The HTML is only text. The browser parses it into a tree of elements called the DOM and turns the CSS into a matching style tree. It combines the two, works out the size and position of every box (layout), then paints pixels on the screen [1]. As it reads the HTML it finds images, styles and scripts and requests each of those too [2]. Large scripts can delay the moment the page responds to clicks [1].
FAQ #
What is the difference between a URL and a domain name? #
The domain name is just the site's name, like example.com. The URL is the full address, including the protocol and path, such as https://example.com/page.
Why do some pages load faster the second time? #
Browsers save some answers and files, including DNS results and images, so they can skip steps. They also often reuse an existing connection [2].
Where does a CDN fit in? #
A CDN can answer step 4 from a server close to you instead of the site's main server, which cuts the distance each trip has to travel.
What if the DNS lookup fails? #
The browser cannot find where to connect, so you usually see an error saying the site cannot be reached, even if the server itself is fine.
Sources #
All sources accessed 2026-10-27.
- How browsers work. MDN Web Docs. https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/How_browsers_work
- An overview of HTTP. MDN Web Docs. https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Overview
- DNS. MDN Web Docs Glossary. https://developer.mozilla.org/en-US/docs/Glossary/DNS