How the Web Works

Posted 2015-03-24 05:00 PM GMT

I love the Web. I have loved the Web for a long time, from online chat rooms and Flash Games in the 90's to Gmail, Facebook, and Wikipedia in the early 2000's to my current role as a professional Web developer. The Web has changed the way we shop, the way we watch TV and movies, the way we work, the way we read the news, the way we socialize, the way we find jobs and show our work experience; in short, the Web has changed the way we live. Considering the fundamental role the web now plays in our lives, I believe we should all have at least a basic understanding of how it works.

The Internet is More Than Just the Web

The Web is a part of the Internet, but there is much more to the Internet, and the Internet is much older. Email, instant messengers, SSH, BitTorrent, and ftp are a few examples of applications of the Internet that are not a part of the Web (or at least they weren't originally).

The Web is a collection of interconnected documents that can be requested using HTTP, and are generally viewed using a Web browser. In recent years, the Web has grown beyond a simple collection of documents to a collection of interconnected applications. Though the terms are sometimes used interchangeably, the Web is not the entire Internet (but it's probably the best part).

What You See

HTML, hyperlinks, and Web Pages

Sir Tim Berners-Lee

The documents that make up the Web are written in a specialized format called HTML. HTML and the Web were originally proposed in 1989 by Tim Berners-Lee (pictured above) as a way to link together academic articles. HTML (Hypertext Markup Language) is the language that allows documents to be linked together using hypertext (AKA hyperlinks, AKA links). HTML contains both the content to be displayed and a description of the content. Web browsers us CSS to decide how things on a web page look and JavaScript to decide how things on a web page act.

Where it Comes From

Servers, HTTP, and URLs

A server is a computer that stores the HTML documents, ready to be "served" to anyone who asks for them. Requests for Web documents are made over HTTP (Hypertext Transfer Protocol) using URLs (Unifrom Resource Locators). When a server receives a request, it looks for the HTML document associated with the given URL. Modern web servers often create the HTML document as it is requested (e.g. the Facebook feed is different every time you see it, but the URL is the same).There are different types of requests for different purposes. The most commonly used types of requests are GET and POST. An easy way to remember what GET and POST do is to think of a blog.


A GET request is a request to retrieve or "get" some data from the server. When you want to view a blog, you make a GET request.


A post request is used when you want to send or "post" some data to the server. When you want to "post" an entry on your blog, you make a POST request.

How it Gets From Here to There

IP Addresses, DNS, and routing

Every device that is connected to the Internet is assigned an IP address, which is a really big number that identifies the device. (Side note: we made so many Internet connected phones that the really big number wasn't big enough, so we had to switch to IPv6). When you try to go to or, the Internet doesn't know to which server to send the request, because the Internet only knows about IP addresses, not When you send your request, the first place the request goes is to a DNS (Domain Name System) which is like a big phone book that maps domains like and to IP addresses like and

Once the IP adress is found, the request bounces through a bunch of routers before finally finding the server. Routers tend to send requests in generally the right geographic direction, depending on a number of factors including other network traffic. Eventually the request will reach the server, and the entire journey usually takes less than 1/10 of a second. The request is sent with a return (IP) address, so the server knows where to send the response.

Browsers Bring it All Together

When you type "" in your browsers address bar, the browser makes a GET request, which does a DNS lookup to find's IP address. Then routers shepherd the request to the correct server. The server finds the document that is being requested and sends a response, which is routed back to the computer (or phone) that made the original request. When the browser receives the response, it processes the HTML, CSS, and JavaScript (and makes additional requests as necessary) and displays the webpage. With so many steps and so many places where things could go wrong, it may seem like a wonder that the web works at all. But it does, and now you know a bit more about how.

If you are interested in learning more about the Web, computers, and programming, check out my book, Learning to Program.