webdev.complete
🌍 How the Web Actually Works
🧱Foundations
Lesson 1 of 117
15 min

Internet vs Web

Packets, IPs, ports, and why your browser is basically a fancy phone.

Open a new tab. Type youtube.com. Hit enter. Eight things happened in the next 300 milliseconds, and almost nobody can name them in order. By the end of this lesson, you can.

The internet is not the web

These two words get used interchangeably and it's wrong. Here's the difference in one sentence:

The internet is the global network of computers. The web is one application that runs on it.

Email, video calls, Steam game downloads, Bluetooth speakers (sometimes), SSH sessions - they all use the internet but are notthe web. The web specifically means "documents and apps served over HTTP and viewed in browsers."

Mental model
Think of the internet as roads, and the web as one type of vehicle driving on them. Email is a different vehicle. So is BitTorrent.

How computers find each other: IP addresses

Every device on the internet has at least one address called an IP address. There are two flavors you'll see:

  • IPv4: four numbers, like 142.250.193.46. We've run out of these.
  • IPv6: longer, like 2607:f8b0:4005:80c::200e. The new format. Plenty of these.

Open your terminal and try this. It looks up the IP for google.com:

bash
dig google.com +short
# 142.250.193.46

ping google.com
# replies from 142.250.193.46

Ports: many doors on one building

A computer with one IP address can run many services. How does traffic know which one to reach? Ports. A port is a number from 0 to 65535. Common ones you should recognize on sight:

  • 80 - HTTP (insecure web)
  • 443 - HTTPS (secure web)
  • 22 - SSH (remote shell)
  • 5432 - PostgreSQL
  • 3000 - what every dev server defaults to (convention, not standard)
When you visit https://example.com, the browser is really connecting to example.com:443. The port is hidden because 443 is the HTTPS default.

TCP vs UDP: two ways to send packets

Data travels in small chunks called packets. There are two main protocols for sending them:

  • TCP - reliable. Packets arrive in order. Lost ones get re-sent. Used for: web pages, emails, file transfers. The boring, dependable choice.
  • UDP- fire-and-forget. No re-sending. Faster but lossy. Used for: video calls, gaming, DNS. The fast, "close enough" choice.

HTTP/1 and HTTP/2 use TCP. HTTP/3 uses something called QUIC, which is built on UDP. That's why HTTP/3 is faster on patchy mobile connections.

The 8 steps when you visit a URL

Putting it together. You type youtube.com:

  1. Browser checks its cache: do I already have this?
  2. If not, it does a DNS lookup - turn youtube.com into an IP address.
  3. Browser opens a TCP connection to that IP, on port 443.
  4. A TLS handshake negotiates encryption keys (this is the "S" in HTTPS).
  5. Browser sends an HTTP request: GET / HTTP/2.
  6. Server processes it, sends back HTML + headers + status code 200 OK.
  7. Browser parses HTML, fires off more requests for CSS, JS, images, fonts.
  8. Browser renders pixels. You see the page.
You'll see this again
Every chapter in this course peels back one of these 8 layers in more detail. DNS gets its own lesson. So does HTTP. So does TLS. So do the rendering steps.

Quick quiz

Quiz1 / 3

What's the difference between the internet and the web?

Recap

  • Internet = network of networks. Web = one application on it.
  • Devices have IP addresses (v4 short, v6 long).
  • Ports let one IP host many services.
  • TCP reliable, ordered. UDP fast, lossy.
  • When you load a URL: cache → DNS → TCP → TLS → HTTP request → response → render.