The invisible magic behind the internet
Hey did you notice what just happened? You clicked a link, and now here you are reading this article. But did you think about how your phone knew that the link you clicked referred to this article, and that this article contained these words?
Navigating the internet is something so common that we don't think about it, but the mechanism behind it is fascinating.
What even is a website? And where?
Let's start from the end: when you open google.com what you are doing is fundamentally just opening a file, like you could open a Word document.
The tricky part is how to get the correct file, it's clear that your phone doesn't come pre-packaged with all the files for all the websites in the world, so how does it find the right one?
For your computer to be able to get the file for the website, it surely must be saved somewhere, and indeed it is: for every website there is a computer, a server, somewhere on Earth that has the file saved.
Every computer connected to the internet has a unique address, just like your home address, if a bit less readable: something like 18.104.22.168. This address is chosen for you by your internet provider and the internet basically acts as a giant postal service that can deliver messages from any computer to any address.
A primitive web
The first method to open a website is to know the IP address of the computer where the file is stored, if you type it in the address bar your browser will send a message to the server asking for the file and the server will kindly respond with a message containing the file.
This is not a common method to access a website, but it does indeed work, you can try it out with the IP for Google: 22.214.171.124.
A more intuitive system
Very early on in the life of the internet a better system was introduced: the Domain Name System, DNS for short. There are a few computers around the world that store a giant table matching every website domain, for example google.com, to the IP address of the server storing the file for the website.
The IP addresses of the computers storing this table come already saved on your phone when you buy it. So when you type google.com in the address bar your phone sends a message to the DNS server asking for the IP corresponding to the domain google.com, the DNS replies with the correct IP and then your computer goes on to open the website with the "primitive method" from before.
The Dark Side of the Web
An article on how the internet works wouldn't be complete without mentioning that what we described is only how the "mainstream" internet works, but there are people who, for legitimate or illegitimate reasons, use alternative means of navigating the web: darknets.
The most well known darknet is the one based on Tor. On a darknet there is no DNS and instead of sending the messages straight from sender to receiver they are passed around between many computers in the network, every computer only knows who to send the message next. All these hops around the network make it impossible for anyone to know who the original sender of the message was, thus granting total anonymity.
Now you know how complex the internet machine is and here comes the best thing about it: it worked flawlessly even before you knew anything about how it did it.