How The Internet Works

By @zachfeldman
Written on Jan 15, 2014

Part of the prework for our Introduction to Web Design and Development 100 class used to include an article about how the internet works. Since the article was taken down, we’ve been searching for a replacement. Most of these candidates for the spot included a ton of pop up ads and spam for some reason, so here we are writing our own!

Let’s start with the basics.

What is a website?

A website is simply a collection of files. Some of these files, including HTML (.html, .htm), CSS (.css) and JavaScript (.js) files ,are being interpreted by your browser (Google Chrome, Firefox, Safari, etc.) and denote how things are laid out on your screen as well as the interactions you’ll experience on the page. Other files like image files (JPG, PNG, etc.) are displayed based on instructions relayed in the HTML, CSS, and JavaScript files or simply downloaded to your computer for further use.

this-is-a-website Believe it or not, this is a website!

This folder of two files could be viewed entirely locally by simply right clicking the index.html file and opening that file in my browser of choice. The problem with keeping all of these files on your computer so that other people can access your website is that your computer normally has pretty bad uptime. Every time you close your laptop or turn off your computer to save power, your website would go down. This is why we put our websites on the computers of a web host like MediaTemple, BlueHost, or HostGator so that we don’t have to worry about people being unable to access the files that makeup our website. The web hosts refer to these computers as servers because they serve a website’s files to clients around the world.

Awesome! Now how does everyone access my website once it’s hosted somewhere?

Your website is accessed through the Domain Name System (DNS). When you enter a website’s address in your browser, it makes a request to lookup exactly which computer your website lives on in the vast network of computers around the world, based on the address entered. These computers are identified by a unique IP address, a 4 number code used to identify computers around the world to other computers. An IP address usually looks like this:

So when you enter a domain name into your web browser’s address bar, it is translated into an IP address so your browser knows which computer to connect to in order to download that website. Think of DNS as the “phonebook of the internet”, translating human readable names (domain names) to machine readable numbers (IP addresses). Once the IP address is known, a connection is made from your computer, to your ISP (Internet Service Provider, think Comcast, Time Warner Cable, etc), and usually through some further intermediaries before the computer the website you are accessing on is reached. After the connection has been made to the computer the website is on, it will attempt to locate an index file, which is the defacto homepage for the website. If it finds that file, it will download the file and display its contents in your browser.

When you click a link on the web page, your browser will download the HTML code for that page and display it to you as well.

The internet is a combination of “file collections” (websites) that are loaded by looking up which computer they’re located on worldwide. It’s that simple!

X-posted from the New York Code + Design Academy blog.

Sign up for our e-mail list to hear about new posts.