How does the internet work?
Feels like we're swimming in it these days. No wonder we take it for granted.
But like power, when it goes down, we get glimpses of medieval times where you couldn't get millions of answers to any question in milliseconds. Scary stuff.
I often have moments of metacognition when sending messages online. I'm baffled by all of the hardware and physics involved. We're having video calls in real-time with people thousands of miles away. All of that information is carried turbo fast through code, waves, light, cables?
This post will un-WTF the Internet for you. Make you go from "this is sorcery" to "this is amazing".
So. You've heard of browsers and servers. Modems, routers, Wi-Fi, and the "cloud". You know the internet can be fast or slow. You can use it on your phone, your computer, your TV—often all at the same time.
Great. Now say I were to ask you: "describe the steps needed for a meme to go from one phone to another". You'd probably tell me to F off. Or use a shrug emoji. 🤷
We'll start our internet journey here then. With the sharing of a meme. Alice has this one saved in her phone:
She wants to share it with Bob, who loves memes. In the comfort of her living room, Alice unlocks her iPhone and accesses her images folder.
(There's a S ton of things happening just there, which I'll cover in an upcoming "How code works" post. Let's focus on that internet for now).
She opens the file, hits "share via Messenger". A chat app overlays her screen, she selects Bob, hits "send".
Now the fun begins. Alice's phone turns her input—"I'm here and want to send this meme to Bob who's there"—into packets of information.
These are composed of smaller bits of data, 1s and 0s—binary code. That's how computers speak at the lowest level. These packets also have headers, which contain key info on involved IP addresses (where the info's from and where it's going).
See, the Internet uses a specific protocol to send and receive information across its network. We call this the Internet Protocol—IP in short. Original, I know.
- A single 1 or 0 = 1 bit
- 8 bits = 1 byte
- 1 000 000 bytes = 1 megabyte (MB)
- 1000 megabytes = 1 gigabyte (GB)
So, if you explode your 4GB monthly data plan, it means you exchanged 34 359 738 368 1s/0s.
If you were to count these numbers at 1 per second, it would take you 397 682 years. Your badass network only takes minutes.
Now, there's an antenna in your phone - you knew that, right? They used to be pretty visible:
That antenna takes these packets of info and turns them into—I kid you not—frequencies. These frequencies ride radio waves. We thus go from digital (1s & 0s) to analog signal (frequencies).
Alice's router then picks up the signal containing the encoded information.
Routers manage the "local" traffic flow—information circulating between different devices inside your home or office.
Once it has everything gathered, it passes the ball to its amigo, the modem.
Modems, too, take the binary code (digital) that has been created by our devices and transform them into frequency-based signals (analog). We can then send these outside our homes, over the Internet.
Still with me? Good. Here, we jump from waves to cables. We used to have only good ol' trusty electrical wires. Today we have fiber optic cables. They're real fancy. They contain a mesh of glass that can carry information by way of LIGHT.
(I had a lightsaber joke, but it didn't make the cut.)
Inside fiber optic cables, the message is encoded onto waves in "words" (chunks of information).
Because these signals travel at the speed of the light inside the cables, they're transmitted very fast. And since we have tons of frequencies available to send that signal, it can carry LOTS of information. Each available frequency corresponds to different series of bytes.
The geek friend who explained that stuff to me said:
The algorithms deployed to optimize this signal would make you fall on your ass.
I fell on my ass more than enough for this lifetime, so allow me to cut this explanation here. 😅
Now that we have encoded the signal, the doggo meme is ready to travel within the wires mentioned above.
You know, the wires plugged into the back of your modem. They go somewhere. They go to other, bigger machines, which also have other, bigger cables connected to them.
The hierarchy here looks like this:
- local router → Internet Hubs → INTERNET BACKBONE
In our case, the doggo meme's packets go through this adventure:
- Alice's home → A big building filled with servers couple miles from Alice's home → A bigger building filled with more servers near the ocean → That same building on the other side of the ocean → A big building filled with servers couple miles from Bob's place → Bob's place
All of that happens almost instantaneously. It's like teleportation. It's amazing.
Fun fact: there are (surprisingly small) trans-oceanic cables connecting data centers all over the globe. They're sturdier today—but sharks could once, literally, bite through the Internet and make it crash.
Video proof? Sure.
Here's the part where I'd say, "That's it!"
But this ain't it. Internet is much more complicated than this. For instance, I haven't even touched domain names and DNS. Or clients vs. servers. However, this was a good primer. It provides a mental model for the Internet's basics, anchored in "real life".
Now, if all of this human ingenuity doesn't blow your mind, I don't know what will. Bitcoin, maybe.
It's funny—it took the doggo meme milliseconds to get from Alice to Bob's phone. But it took me a couple of hours to explain how it got there.
Oh well. At least it'll only take milliseconds to share that post with thousands of people all over the world. 🙌
If you like this post, please share it on social somewhere.
I want to do more of these simple, story-driven explainers. I hope they help you understand the web as much as they help me.
- How Does The Internet Work - Standford
- How Does the Internet Work? - Glad You Asked
- Fiber optic cables: How they work - engineerguy
- Internet Protocol - Wikipedia
- My colleagues Mathieu & Guillaume 💛