What Actually Happens When You Open a Website?

In the second or so after you tap a link, your phone looks up an address, opens a secure connection, asks for a page and builds it from dozens of files.

Short answer

Your browser first asks the Domain Name System (DNS) for the numeric address of the site’s server. It then opens a connection to that server, sets up encryption with TLS (the padlock), and sends an HTTP request asking for the page. The server replies with an HTML document, and the browser fetches the images, styles and scripts it lists before drawing the page. Caches often let it skip steps, which is why repeat visits feel faster.

In this article 10 sections
  1. The journey at a glance
  2. Step 1: Finding the address with DNS
  3. Step 2: Opening a connection
  4. Step 3: Making it private with TLS
  5. Step 4: Asking for the page with HTTP
  6. Step 5: The server’s answer
  7. Step 6: Building the page
  8. Why it’s usually so fast
  9. What this explains in everyday life
  10. Related guides
Close-up of labelled network cables plugged into servers in a Wikimedia Foundation data centre, lit by blue and green status lights.
Servers like these at the Wikimedia Foundation answer the requests browsers send when people open Wikipedia. Photo: VGrigas (WMF) / Wikimedia Commons, CC BY-SA 3.0

The journey at a glance

Opening a web page is a conversation between your device and several computers you never see. The step-by-step demo below follows one visit from start to finish. Each numbered step is explained in the sections that follow.

Try it

Watch a page load, one step at a time

Follow what your browser does the first time it opens a page, then what it can skip on a repeat visit.

  1. Your deviceBrowser
  2. DNS resolverAddress book
  3. Web serverHas the page

First visit about 300 ms in total (illustrative)

  1. Where is example.com? Your browser asks a DNS resolver for the numeric address (IP address) of the site’s server. ~30 ms
  2. 203.0.113.10 The resolver answers with the address, and your device keeps a copy for a while in its DNS cache. part of the 30 ms
  3. Hello — can we talk? Your device opens a connection to that address, a short back-and-forth before any data moves. ~40 ms
  4. Let’s encrypt this The two sides agree on encryption keys with TLS, so nobody in between can read or change the traffic. ~40 ms
  5. GET / (the page, please) The browser sends an HTTP request asking for the page. ~60 ms
  6. HTML, then images, styles, scripts The server sends the page; the browser fetches the files it links to, stores some in its cache, and draws the page. ~130 ms

Visiting again about 140 ms in total (illustrative)

  1. Address already known The address is still in your device’s DNS cache, so there’s no need to ask the resolver again. ~0 ms
  2. Resume where we left off The browser may reuse an open connection or resume the earlier encrypted session, so setup is shorter. ~40 ms
  3. GET / — changed since last time? It asks for the page again and, for files it already has, asks only whether they have changed. ~40 ms
  4. New HTML · “not changed” for the rest The server sends the fresh page; unchanged images and styles come from the browser cache instead of the network. ~60 ms

One possible scenario. Times are illustrative, not real measurements — they change with your network, distance to the server and the site itself.

In words, the stages are:

  1. Find the address — DNS turns a name like example.com into an IP address.
  2. Connect — your device opens a connection to that address using TCP or QUIC.
  3. Secure it — TLS checks the site’s identity and encrypts the connection.
  4. Ask — the browser sends an HTTP request for the page.
  5. Answer — the server sends back a response, usually an HTML document.
  6. Build the page — the browser loads the other files the page needs and draws it.

Step 1: Finding the address with DNS

Computers on the internet find each other with numeric IP addresses. People prefer names. The Domain Name System is the internet’s directory that connects the two.

When you type a web address, your device asks a DNS resolver — usually run by your internet provider, your mobile network or a DNS service you’ve chosen — for the IP address that belongs to the name. If the resolver doesn’t already know, it asks the servers responsible for that domain, then passes the answer back and remembers it for a while.

Network equipment in a rack with labels reading ROUTER.AMS-IX.K.RIPE.NET and K.ROOT-SERVERS.NET, connected by blue, green and orange cables.
A copy of K-root, one of the DNS root servers, at the AMS-IX exchange in Amsterdam. Root servers point resolvers towards the servers responsible for each domain. Photo: Bas van Schaik / Wikimedia Commons, CC BY-SA 3.0

What you might see when this step fails

Messages such as “Server not found” or “DNS address could not be found” usually mean the name couldn’t be turned into an address: a typo, a domain that doesn’t exist, or a problem with the network’s DNS. The website itself may be perfectly fine.

When this lookup fails, Chrome shows an error called DNS_PROBE_FINISHED_NXDOMAIN; here is what it means and how to fix it.

Step 2: Opening a connection

With an address in hand, your device opens a connection to the server. Traditionally this uses TCP, a protocol that makes sure data arrives complete and in the right order by numbering pieces and resending anything lost.

Many large sites now also support QUIC, a newer transport that runs over UDP and builds encryption in. It is used by HTTP/3 and can set up a secure connection in fewer round trips, which helps on slow or unstable mobile connections.

Step 3: Making it private with TLS

Before anything personal is exchanged, browser and server run a TLS handshake. Two things happen:

  • Identity check. The server presents a certificate showing it is entitled to use the name you typed. Your browser checks that a trusted certificate authority vouches for it.
  • Encryption. The two sides agree on keys, so the rest of the conversation can’t be read or altered by networks in between.

The padlock or “secure” indicator means this worked. It tells you the connection is encrypted and the certificate matches the address. It does not tell you the site is honest — a scam site can have a valid certificate for its own name.

When the browser warns you

A full-page certificate warning means the identity check failed. On a public Wi-Fi network this can happen when a sign-in page intercepts traffic. Don’t type passwords or payment details while that warning is showing.

Step 4: Asking for the page with HTTP

Now the browser sends an HTTP request. At its simplest it says “GET me the page at this path on this site”, along with details such as which languages and file formats the browser accepts. Because of step 3, the request travels encrypted.

Step 5: The server’s answer

The server replies with a status code and the content. A few codes you may recognise:

Common HTTP status codes
CodeMeaningWhat you see
200 OKHere is what you asked forThe page loads normally
301 Moved PermanentlyIt lives at a new address nowThe browser jumps to the new address automatically
404 Not FoundNothing exists at this addressThe site’s “page not found” screen
500 Internal Server ErrorSomething broke on the serverA generic error page; reloading later may help

If the answer is an error such as 404 or 503 rather than the page, our guide to what website error codes mean explains each one.

Step 6: Building the page

The first response is usually an HTML document: the page’s text and structure. It also lists everything else the page needs — CSS files that control layout and colours, images, fonts and JavaScript that adds interactive features. The browser requests these too, often several at once and sometimes from other servers.

As files arrive, the browser works out the layout and paints the page on your screen. It can show readable text before every image has loaded, which is why pages sometimes appear in stages.

Why it’s usually so fast

All of this typically takes a fraction of a second to a few seconds, because most steps can be shortened:

  • Caching. Your device and DNS resolvers remember recent answers, and your browser keeps copies of files it has already downloaded. Repeat visits skip work.
  • Content delivery networks (CDNs). Many sites store copies of their files on servers around the world, so your request travels a shorter distance.
  • Reused connections. Once a secure connection is open, the browser can use it for many requests instead of starting again.

What this explains in everyday life

  • “Site can’t be reached” on one network but not another often points to DNS or the network, not the site.
  • A page that loads text first, then jumps around is the browser filling in images and styles as they arrive.
  • A padlock on a suspicious site isn’t reassurance about the site’s honesty — only that your connection to that site is encrypted.
  • Slow first visit, fast second visit is caching at work.

Sources and further reading

  1. How the web works — MDN Web Docs (Mozilla)
  2. RFC 1034: Domain names — concepts and facilities — IETF
  3. RFC 9293: Transmission Control Protocol (TCP) — IETF
  4. RFC 9000: QUIC, a UDP-based multiplexed and secure transport — IETF
  5. RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 — IETF
  6. RFC 9110: HTTP Semantics — IETFDefines requests, responses and status codes such as 404.

Was this article helpful?

Comments

No comments yet. Questions and tips from readers are welcome.