Skip to the content

Lesson 1 of 296

How the internet works

What you will learn

  • What the internet is
  • What a client and a server are
  • What a request and a response are
  • What a URL, a domain name and an IP address are
  • What happens, step by step, when you open a website
On this page

What is the internet?

The internet is a very large number of computers connected to each other so they can send data to each other. That is all it is. When you open a website, your device asks another computer for some files, and that computer sends them back.

Client and server

There are two roles in almost everything on the web.

  • Client: the device or program that asks for something. Your phone, your laptop and your browser (Chrome, Safari) are clients.
  • Server: a computer that waits for questions and answers them. It stores the website's files and data. A server is a normal computer, but it stays switched on all day and night and is connected to the internet.

One server can answer thousands of clients at the same time.

Request and response

The client and the server talk using two messages.

  • Request: the message the client sends. It says "please give me this page" or "please save this data".
  • Response: the message the server sends back. It contains the page, the data, or an error.

This always happens in the same order: the client sends a request first, then the server sends a response. A server never sends a page unless a client asked for it.

Example

You type https://www.bbc.co.uk/news in your browser and press Enter.

Client (your browser)  ---- request:  "Give me /news" ---->  Server (BBC)
Client (your browser)  <--- response: "Here is the page" ---  Server (BBC)

The parts of a URL

A URL is the full address of something on the web. Look at this one:

https://www.bbc.co.uk/news?page=2
PartNameWhat it means
https://ProtocolThe set of rules used to talk. HTTPS means the data is locked (encrypted) while it travels.
www.bbc.co.ukDomain nameThe name of the website.
/newsPathWhich page or file on that website.
?page=2Query stringExtra information sent to the server. Here: "give me page 2".

IP addresses and DNS

Computers do not find each other by name. They use numbers. Every computer on the internet has an IP address, for example 151.101.0.81.

People cannot remember numbers like that, so we use domain names such as bbc.co.uk. A system called DNS (Domain Name System) changes the name into the IP address. DNS works like the contact list on your phone: you choose a name, and the phone finds the number.

HTTP and HTTPS

HTTP is the set of rules that clients and servers use to send requests and responses. HTTPS is the same thing with encryption added, so nobody between you and the server can read the data. Today almost every website uses HTTPS. You will learn HTTP in detail in Part 15.

What happens when you open a website: step by step

  1. You type the URL and press Enter.
  2. The browser asks DNS: "What is the IP address of bbc.co.uk?"
  3. DNS answers with the IP address.
  4. The browser connects to the server at that IP address.
  5. The browser sends a request for the page.
  6. The server finds or builds the page and sends a response.
  7. The browser reads the response and shows the page on your screen.

All of this usually takes less than one second.

Common mistakes

  • "The internet and the web are the same thing." They are not. The internet is the network of connected computers. The web is one thing that runs on it (websites). Email and video calls also use the internet but are not the web.
  • "A server is a special kind of machine." Any computer can be a server. What makes it a server is the job it does: answering requests.

How to say it in an interview

"The web works on a client and server model. The client, usually a browser, sends an HTTP request to a server. DNS is used first to turn the domain name into an IP address. The server processes the request and sends back a response, and the browser shows the result."

Key words

WordMeaning
ClientThe device or program that asks for something
ServerThe computer that answers requests
RequestThe message from client to server
ResponseThe message from server to client
URLThe full address of a page or file
Domain nameThe readable name of a website
IP addressThe number that identifies a computer on the internet
DNSThe system that turns domain names into IP addresses
HTTP / HTTPSThe rules for requests and responses; HTTPS is encrypted

Now prove it

This lesson is complete when you pass the quiz and all three practice levels.