designwithfocus

Networking & internet basics

How the Internet Works: From a Click to a Loaded Page

By Design With Focus Team 6 min read
Browser window with a simplified path from a click through name lookup to a loaded page

Short answer

How the internet works is a short chain from your device to a server and back. DNS turns the name you typed into an IP address. The browser opens a TCP connection and sends an HTTP request. The server returns a response, and the browser builds the page from it. The Internet is the network. The Web is one service on that network.

Last verified against the sources listed below.

Key takeaways

  • The Internet is a network of networks. The Web is a service that uses it, along with email and other services.
  • DNS maps a domain name to an IP address so computers can find each other.
  • HTTP requests and responses travel over TCP, or over a TLS-encrypted TCP connection.
  • A browser fetches an HTML document, then asks for the images, styles, and scripts that page names.
  • HTTP is stateless. Cookies can still tie requests together into a session.
  • A home router is often a switch, a router, and a modem in one device.

People asking how the internet works want the path from a click to a page, not a history lecture. MDN’s guide to the Internet calls the Internet a large network of computers that stay connected, and the Web a service built on that network.

Your browser cannot send a request to a name the way you remember one. It needs a numeric address, a connection, and a message format the server understands. A diagram of that path would label five boxes, and this article uses those labels without pretending to draw the picture.

What does your device do before any request?

Your device starts on a local network, then hands the message to a router. MDN’s network story begins with computers linked by cable, or wirelessly by Wi-Fi or Bluetooth. A network switch forwards messages by MAC address, which identifies a network interface.

Ten computers would need 45 cables if every pair had its own cable, and only 10 once a switch is in the middle. A switch does not join separate networks, and a router does. MDN describes an IP address as a four-number sequence, with 142.250.190.78 as an example that can change, and a home box often combines switch, router, and modem.

Step a diagram would label What that step does
Device Prepare the request on the local network
DNS Map the name to an IP address
TCP and HTTP Open a connection and send an HTTP request
Server Handle the request at the destination
Response Return a status and, if it works, the resource

How does a name become an address?

DNS turns the name you typed into an IP address. ICANN’s glossary says every computer on the Internet has an IP address, and that IP stands for Internet Protocol. Those numbers are hard to remember, so the Domain Name System lets a familiar string of letters stand in for them, and ICANN’s example is icann.org standing in for 192.0.43.7.

MDN’s DNS glossary calls DNS a hierarchical and decentralized naming system. A DNS lookup maps a name such as mozilla.org to an address such as 192.0.2.172. The opposite question, which name belongs to an address, is a reverse lookup.

Cloudflare’s DNS guide calls the whole system the phonebook of the Internet. Once the browser has the address, it can make an HTTP request.

Treat the numbers above as the examples those pages publish, not as a live measurement. MDN’s Internet article says the address behind a name can change. A diagram should label the lookup, not a permanent number.

What do TCP and HTTP actually carry?

HTTP is the request language, and TCP is the reliable connection under it. MDN’s HTTP overview defines HTTP as a client-server protocol for fetching resources such as HTML documents. The browser starts the request, and a complete page is usually many resources: text, layout, images, videos, and scripts.

HTTP is an application-layer protocol sent over TCP, or over a TLS-encrypted TCP connection. Of the two common transports that page names, TCP is reliable and UDP is not, so HTTP relies on TCP. The flow is to open a TCP connection, send the message, read the response, then close the connection or reuse it.

A request carries a method such as GET or POST, a path, a version, optional headers, and sometimes a body. A response carries a version, a status code, a status message, headers, and sometimes a body. HTTP/1.1 added persistent connections, HTTP/2 multiplexes messages on one connection, and cookies can build a session even though HTTP itself is stateless.

How does the server build a response?

The server handles the request and sends back a status plus the resource. MDN says a server can look like one machine and still be several machines sharing the load, or software that builds the document on demand. With the Host header in HTTP/1.1, several sites can share one IP address.

Proxies in between may cache, filter, balance load, check authentication, or write a log. The status code is the first verdict, and MDN’s sample success line is HTTP/1.1 200 OK, followed by headers and a body. The browser then asks for the other files the page names.

web.dev’s critical rendering path article describes the work after those bytes arrive: the browser turns HTML, CSS, and JavaScript into pixels. Planning how that page looks is web design.

How is the Internet different from the Web?

The Internet is the network infrastructure, and the Web is a service that uses it. MDN says the Internet connects computers, and some of those computers, called Web servers, send messages a browser can show. Other services share that infrastructure:

  • Email and IRC use the network without being the Web.
  • An intranet keeps a network inside one organization.
  • An extranet opens part of that private network to partners.

The history in that article starts in the 1960s as a US-army-funded research project and becomes a public infrastructure in the 1980s, with universities and companies involved. An Internet service provider manages routers that link to other providers, which is how a message leaves your network.

A click feels local because the browser hides those hops. The name, the address, the connection, and the response are still separate steps, and a routing failure is not the same problem as a missing document.

How can a file ride along in a request?

Some requests carry data, and a file can be encoded as text for that trip. MDN notes that clients also post content, such as an HTML form, and some methods include a request body. A small file can travel in that payload once it is written as text.

The SVG to Base64 tool does that for an SVG, encoding the graphic as Base64 text a request can carry. The encoding is not a new protocol. It only spells the same file so a text field or a script can hold it.

If you labeled a diagram for this article, the boxes would stay the five rows in the table above. Encoding a file is a detail inside the request, and the server still answers with a status and a body.

Frequently asked questions

What is a reverse DNS lookup?

A reverse lookup starts with a numeric address and asks which domain name was associated with it. The ordinary lookup goes the other way, from a name to an address, and that is the direction a browser needs before it can open a connection. Network logs often show only the number, so operators use the reverse direction to recover a name. Neither direction changes the later request. They only answer who the address belongs to.

What is QUIC in this path?

MDN's overview of how browsers fetch resources says experiments are in progress on a transport that suits the Web better than a plain connection. It names QUIC, which builds on UDP, the transport that page describes as unreliable, and aims to make that path more reliable and efficient. The same page still says the usual reliable transport is TCP. Treat QUIC as the experiment that page describes, not as a box every diagram must include.

Do intranets use a different set of protocols?

An intranet is a private network limited to an organization. An extranet opens part of that private network to partners or clients. MDN says both run on the same kind of infrastructure as the public Internet and use the same protocols. A page load inside an office can still be drawn as a name lookup, a connection, a request, and a response. The extra control is who may join the network.

Why do cookies exist if each request stands alone?

Nothing in the core message format ties one request to the next, even when they share a connection. A shopping basket would forget you between clicks. Cookies, carried in headers, let the browser and the server share context so those separate requests form a session. A proxy cache is a different kind of memory. It stores a copy of a response. It does not, by itself, remember a shopper.

What are the four DNS server roles in an uncached lookup?

Cloudflare's learning page describes four roles when nothing is cached. A recursive resolver takes the question from the browser. A root nameserver points toward a top-level domain server, such as the server for com. That server points toward the domain's authoritative nameserver, which can answer with the address. Cached answers skip some of those hops. The browser still ends with an address it can request.

Sources