What happens when you open a website
The half second between pressing enter and seeing a page, unpacked hop by hop: name lookup, connection, encryption, request, server, and the paint on your screen.
You type a web address
You type an address and press enter. What feels instant is really a relay race across a dozen machines, often on two or three continents, and the whole thing usually finishes in under half a second.
Browser parses the address
The browser first splits what you typed into parts: the scheme, the host name, the path. Only the host name matters right now, because the browser still has no idea which machine on Earth answers to it.
Local caches checked
Before asking anyone, it checks its own memory, then the operating system's underneath. A site you visited a minute ago can skip the next several steps entirely, which is exactly why the second visit feels so much faster.
DNS resolves the name
If nothing is cached, a resolver goes hunting for the numeric address behind the name. It may question a root server, then a top level server, then the domain's own name server, and still finish in well under a tenth of a second.
Answer cached with a TTL
The answer arrives with a time to live, a countdown in seconds. Set it to three hundred and the world forgets your address in five minutes. Set it to a day and moving servers takes a day to reach everyone.
TCP three way handshake
Now the browser opens a connection. Your machine says hello, the server says hello back, your machine confirms. That three way handshake costs one full round trip before a single byte of the actual page has moved.
TLS encryption agreed
Then encryption. The server proves its identity with a certificate, both sides agree on a secret key, and from here everything is unreadable to anyone in between, including the cafe wifi and your internet provider.
HTTP request sent
Finally the request itself: a short block of text naming the page you want, the browser you are using and any cookies for this site. It is often smaller than a single paragraph of this narration.
CDN edge answers if it can
Most requests never reach the real server. A content delivery network keeps copies in hundreds of cities, so the reply can come from a machine a few miles away instead of a data centre an ocean apart.
Origin server runs the app
For anything personal, the origin server runs your request through actual code: check the session, look up the account, decide what this particular person is allowed to see on this particular page.
Database returns the data
The application asks a database for the pieces it needs. A well tuned query answers in a millisecond or two, while one missing index can turn that same query into a two second stall the whole page waits on.
Response streams back
The response streams back compressed, usually with gzip or brotli, which typically shrinks a page to a quarter of its size. The browser starts work on the first bytes long before the last ones arrive.
Markup parsed into a tree
The browser reads the markup and builds a tree of every element, then a second tree of styles. A typical news page carries a couple of thousand elements, and those two trees together decide what each box is, where it sits and what colour it gets painted.
Images, styles and scripts fetched
The page is really just a shopping list. Images, fonts, scripts and stylesheets each need their own fetch, and a typical modern page pulls in about seventy of them, many travelling at once down the same connection.
Pixels painted on screen
Layout, paint, done. All of that happened while your finger was still leaving the enter key. Click a link on the same site and the browser reuses the open connection, skipping straight past the lookup and the handshake.
Watch it explain itself
Every step above is narrated aloud. Play it, or open it in the editor and make it yours — no account needed.