Web Fundamentals

How the Internet Works

The internet is a network of networks that moves packets between computers. Understanding clients, servers, IP and the request/response cycle makes the whole web less mysterious.

beginner15 min readUpdated Sep 15, 2026
request.sh
bash
# request.sh
curl -i https://example.com

# HTTP/2 200
# content-type: text/html; charset=UTF-8
# cache-control: max-age=86000
#
# <!doctype html>
# <html> ... </html>
Model
Network of networks
Unit of data
Packets
Addressing
IP addresses
Transport
TCP and UDP
Names
DNS
Web protocol
HTTP / HTTPS

Why it matters

Why the basics matter

No single owner

The internet is a cooperative network of independent networks that agree on shared protocols.

Packet switching

Data is split into packets that travel independently and are reassembled at the destination.

Layered by design

Each layer handles one job, so new protocols and applications can build on the layers below.

The big picture

The three layers of the web

Addresses find machines, transport moves bytes, and protocols give those bytes meaning.

Addressing

Find

IP addresses identify machines, and DNS maps human names onto them.

Transport

Move

TCP delivers an ordered stream of bytes reliably; TLS encrypts it.

Application

Use

HTTP and the browser turn bytes into pages you can read and interact with.

The internet at a glance

The core ideas

Clients and servers

Clients request; servers respond. Your browser is the most common client.

IP addresses

Every device on the network has an address so packets know where to go.

DNS

The phone book that turns example.com into an IP address.

TLS

Encrypts traffic so it cannot be read or altered in transit.

Routing

Routers forward packets hop by hop across many networks.

CDNs

Caches serve content from a location near the user.

A short history

From ARPANET to the modern web

  1. 1969

    ARPANET

    The first packet-switched network connects four universities.

    69
  2. 1983

    TCP/IP

    A common protocol suite lets different networks interoperate.

    83
  3. 1989

    The World Wide Web

    Tim Berners-Lee proposes hypertext, URLs and HTTP on top of the internet.

    89
  4. 1995

    Commercial internet

    The web opens to the public and grows explosively.

    95
  5. Today

    Global infrastructure

    Billions of devices, undersea cables and CDNs form the modern internet.

    Today

The complete guide

How the Internet Works: Everything you need to know

What is the internet?

The internet is a network of networks. It is not a single machine or company, but millions of independent networks that agree to speak the same protocols so they can pass data to one another. That agreement is what lets a laptop in one country talk to a server in another in a fraction of a second.

The World Wide Web is one service that runs on this network, using HTTP, URLs and browsers. The internet carries much more: email, video calls, file transfer and countless other applications. Understanding the underlying network explains why the web behaves the way it does.

Clients and servers

Almost everything on the web follows a client-server model. A client sends a request; a server sends a response.

  • The client is usually a browser, but it can be a mobile app, a script or another server.
  • The server is a computer that listens for requests and returns resources such as HTML, JSON, images or files.

This request/response cycle is the heartbeat of the web. Every page load, API call and image download is one or more of these exchanges.

IP addresses and packets

Every device on the network has an IP address, like a postal address for data. When you send something, it is split into packets: small chunks of data, each labelled with a source and destination address.

Packets travel independently. Routers along the way forward each one toward its destination, and they may take different paths. The receiving machine reassembles them into the original message. This design, called packet switching, is what makes the internet resilient — if one route fails, packets can go another way.

The transport layer: TCP and UDP

IP gets packets to a machine, but it does not guarantee they arrive in order or at all. That is the job of the transport layer.

  • TCP establishes a connection and provides a reliable, ordered stream. It retransmits lost packets and is what HTTP uses.
  • UDP is connectionless and does not guarantee delivery. It is faster and is used for live video, games and DNS.

On top of TCP, TLS encrypts the connection so nobody in the middle can read or alter it. HTTPS is simply HTTP over TLS.

DNS: names to addresses

People remember names, not numbers. DNS (the Domain Name System) is the phone book that maps a name like example.com to an IP address.

When you visit a domain, your computer asks a resolver, which queries a hierarchy of name servers until it reaches the authoritative one. The answer is cached for a period so repeat lookups are instant. The DNS guide covers the details.

HTTP: the language of the web

Once a connection exists, the browser and server speak HTTP. The client sends a request with a method (like GET or POST), a path and headers; the server replies with a status code, headers and a body.

GET /index.html HTTP/2
Host: example.com
Accept: text/html
HTTP/2 200 OK
Content-Type: text/html
Content-Length: 1256

<!doctype html> ...

The HTTP guide covers methods, status codes, headers, cookies and caching.

What happens when you visit a page

Putting it together, loading a page looks like this:

  1. Resolve the domain with DNS to get an IP address.
  2. Connect to that address over TCP.
  3. Handshake with TLS to establish an encrypted channel.
  4. Request the HTML over HTTP.
  5. Parse the HTML and discover CSS, JavaScript, images and fonts.
  6. Request each of those, often in parallel, and render the page.

Each additional resource repeats part of the journey, which is why fewer requests and smaller assets make pages faster. The Browsers & Rendering guide picks up from step 5.

Routers, ISPs and the backbone

Between you and a server are many networks. Your traffic leaves through your ISP, crosses regional and national networks, and may travel along undersea cables between continents. Routers at each hop decide where to send the next packet based on routing tables.

You never see this, but it explains latency: the farther the data travels and the more hops it makes, the longer the round trip takes.

CDNs and caching

A content delivery network places copies of your content on servers around the world, so users are served from a nearby location. That cuts latency, reduces load on your origin server and improves reliability.

Caching works at several layers: the browser cache, the CDN, and the origin server. Correct cache headers let content be reused instead of refetched, which is one of the biggest performance wins available.

Best practices

  • Serve everything over HTTPS, and redirect HTTP to HTTPS.
  • Use a CDN for static assets and cacheable content.
  • Set sensible cache headers so repeat visits are fast.
  • Keep requests few and payloads small.
  • Prefer HTTP/2 or HTTP/3, which multiplex many requests over one connection.
  • Monitor latency and time to first byte, not just page weight.

Common mistakes

  • Confusing the internet with the web.
  • Assuming data takes a single fixed path.
  • Serving sensitive content over plain HTTP.
  • Ignoring caching and refetching everything on every visit.
  • Treating DNS as instant and ignoring TTLs during migrations.
  • Putting one server in one region and serving a global audience from it.

Where to go next

The internet is the foundation under everything you build. Go deeper on the protocol with the HTTP guide, learn how names resolve in the DNS guide, and see what the browser does with the bytes in Browsers & Rendering. Then open your browser’s network panel and watch a real page load unfold.

Sending data

Encrypted HTTPS protects the content in transit. Plain HTTP exposes it to anyone on the path.

Prefer
# encrypted end to end
curl -I https://example.com
Avoid
# readable by anyone
# on the network
curl -I http://example.com

Serving content

A CDN caches content near the user, cutting latency and load on your origin server.

Prefer
# served from a nearby edge
# cache hit, low latency
curl -I https://cdn.example.com/app.js
Avoid
# every user hits one
# server on another continent

FAQ

Frequently asked questions

Keep learning

Related topics from the roadmap.

$ start learning

Ready to start learning How the Internet Works?

Our interactive tutorial walks you through How the Internet Works step by step — with quizzes and real code you can run in the browser.