How does a website work?

We all use web sites, but how do they work? In the simplest terms a website can be compared to calling a phone number. The first part of getting to the website is looking it up. Just like a phone number, a website has a number too called an IP address that would look something like 64.233.187.99, which happens to be Google. You can see that it would be hard to remember a number like this. So if you wanted to call someone and you know them by name you would look them up in the white pages, which would give you their phone number. This is where a domain name comes into play. If you type the name google.com, which is a domain name, into your web browser it goes out to a computer on the internet called a DNS (Domain Name Server) and looks up the number(s) associated with the domain name. So if you were to type in google.com it would route you to the website using the 64.233.187.99 IP address. If you don't know the domain name then you would likely go to a search engine first to look up a site or domain based on general categories or keywords, similar to the yellow pages.

Once you try to navigate to the site, the internet knows how to route the traffic to the website based on the number, similar to how the phone network knows how to route a phone call by breaking down the number using area code and the exchange, then the last four digits of the number. The IP number will route you to another computer on the internet called a web server. The web server basically says "hello" to your computer and a conversation is begun between your web browser and the web server. Your browser requests certain pages and the web server returns them.

Pages are usually comprised of multiple files both text files and image files. The main text file contains code that tells your web browser how to construct the page and what images and other files are needed as well.