What Happens When You Type a URL and Press Enter?
You type a shop's address, press Enter, and a moment later the page appears. In that moment your browser uses ideas from all nine earlier lessons. This lesson answers what happens when you type a URL and press Enter, step by step, and shows you how to watch each step in your own browser.
The whole journey in eight steps
A URL (Uniform Resource Locator) is a full web address. Loading one takes eight steps, and the first seven each build on an earlier lesson. In the flowchart, notice the dashed shortcut: with a connection already open, the browser jumps from step 2 straight to step 6.
Steps 1 and 2: read the URL, then check what is saved
Take the URL https://www.example.com/shop/shoes?size=9. The browser first splits it into parts:
- Scheme (
https): which protocol to use. HTTPS means port 443 unless the URL names another, and HTTP means port 80 (lesson 2). - Host (
www.example.com): which server to reach. - Path (
/shop/shoes): which page on that server (lesson 6). - Query (
?size=9): optional extra details, such as a search term.
Words that are not an address, such as red running shoes, go to your search engine instead.
Before using the network, the browser checks its caches, its stores of saved copies: files that sites said may be reused for a while, often images and styles (lesson 4); recent DNS answers (lesson 3); connections still open from earlier requests; and sites that said "HTTPS only", so it switches to HTTPS before sending anything.
Each saved item skips work. A fresh saved copy of a file needs no network at all, and an open connection skips steps 3 to 5.
Step 3: DNS turns the name into an address
Routers deliver packets by IP address, not by name, so the browser needs the number behind the host name. With no saved answer, your device asks its recursive resolver, the DNS server that does the whole search for you (lesson 3), and gets back an address such as 203.0.113.7, an example.
If the lookup fails, the journey ends with "This site can't be reached": with no address, the browser has nowhere to connect.
Steps 4 and 5: open a connection, then secure it
The browser opens a TCP connection to that address on port 443 with the three-way handshake: SYN, SYN-ACK, ACK (lesson 5). That costs one round trip: a message to the server and its reply back.
Next comes the TLS handshake (lesson 8): the server shows its certificate, the browser checks the name and dates, and both sides agree keys. TLS 1.3 needs one more round trip, the older TLS 1.2 two. A failed check shows a warning page instead of the site.
So a new HTTPS connection costs two round trips before the first request leaves. With HTTP/3, QUIC does both jobs together in one round trip, over UDP.
Steps 6 and 7: the request goes out, the response comes back
Now the browser sends an HTTP request (lesson 6), sealed inside TLS: GET /shop/shoes?size=9 for www.example.com, with headers that include any cookies it holds for that site (lesson 9).
The machine at that address is often not the one that builds the page. Big sites put a load balancer in front, which passes each request to one of many servers (lesson 14), or a CDN (content delivery network) server near you, which may answer from its own saved copy (lesson 17).
The server may ask a database for size 9 shoes (lesson 4), then answers 200 OK with the page's HTML (HyperText Markup Language) as the body. A redirect such as 301 sends the browser back to step 1 with a new address.
In the timeline, notice that waiting is the longest bar: one round trip plus the server's work. The second bar has no DNS, TCP or TLS, because the connection was reused.
Step 8: the browser builds the page
The browser reads the HTML as it arrives and finds links to more files: CSS (Cascading Style Sheets), the rules for colours and layout; JavaScript, programs that make the page interactive; and images.
Each file is another request, steps 6 and 7 again. Files from the same host can reuse the open connection, and with HTTP/2 many travel over it at once; files from another host usually need their own steps 3 to 5.
Some files hold up the rest. The browser waits for the page's CSS before drawing, so you don't see the page unstyled. An ordinary script, added without the word async or defer, pauses the reading of the HTML until it has downloaded and run. Images don't hold up the first drawing; they appear as they arrive.
Then the browser works out each element's size and position, called layout, and turns it into pixels, called painting. The table sets the whole trip beside the letter. Unlike a letter, it travels as many packets (lesson 1) and takes moments, not days.
Check yourself
Chrome says "This site can't be reached" because the server's IP address could not be found. Did the site's server ever hear from you?
No. Step 3, DNS, failed, so the browser had no address to connect to and steps 4 to 8 never started.
The second page you open on a site shows no DNS lookup, Initial connection or SSL in its Timing tab. Why?
The browser reused the connection opened for the first page, so it skipped steps 3 to 5 and their round trips.
Waiting for server response is 900 ms, while Initial connection is only 30 ms. Is the network or the server the likely problem?
The server. A quick connection means round trips are short, so most of the wait is the server building its reply.