Skip to content
Kuza Ndoto Academy

How Websites Work

BeginnerChapter 1 · Page 2 of 254 min readUpdated 15 Nov 2026

When you type an address and press Enter, your browser has a short conversation with computers that may be on another continent, and the page appears a moment later. Understanding that conversation makes you a better web developer, because you will know where your HTML lives and how it reaches people.

Clients and servers

The web is built on a simple idea: some computers ask for things and others answer.

  • A client is the program that asks. For websites this is your browser: Chrome, Firefox, Safari, Edge or Opera on a phone or laptop.
  • A server is a computer that is always switched on and connected to the internet. It stores a website's files (HTML, CSS, images) and sends them to any client that asks.

The internet is the global network of cables, mobile masts and routers that connects them. The web is one service that runs on top of it, alongside others like email.

What happens when you open a page

Imagine you type www.example.com into your phone's browser. Four main steps follow:

  1. DNS lookup. Computers find each other using numeric IP addresses, not names. The browser asks a DNS (Domain Name System) server which IP address belongs to www.example.com. DNS works like your phone's contact list: you look up a name and get a number.
  2. The answer. The DNS server replies with an address such as 203.0.113.10. Browsers and your device remember (cache) the answer for a while, so later visits skip this step.
  3. The request. The browser connects to that server and sends an HTTP request, essentially a message saying "please GET me the page at /".
  4. The response. The server sends back an HTTP response: a status code such as 200 OK followed by the HTML file.
Browser (the client) DNS server the internet's contact list Web server stores the site's HTML, CSS, images 1. Where is www.example.com? 2. It is at 203.0.113.10 3. HTTP request: GET / 4. HTTP response: 200 OK + HTML
Figure 1. The browser first turns the name into an IP address (steps 1–2), then requests the page from the web server (steps 3–4).

The browser then reads the HTML from top to bottom. Every time it finds a reference to another file, such as a stylesheet, an image or a script, it sends another request for that file. A typical page needs dozens of requests. Finally the browser renders (draws) the page on your screen.

Note

203.0.113.10 comes from a range reserved for documentation, so it does not belong to a real website. Real IP addresses look similar: IPv4 uses four numbers from 0 to 255, while newer IPv6 addresses are longer and use hexadecimal, such as 2001:db8::1.

The parts of a URL

The address you type is a URL (Uniform Resource Locator). Each part has a job:

https:// www.example.com /blog/post.html ?page=2 #comments Protocol how to talk Domain name which server Path which file or page Query string extra data Fragment spot on the page
Figure 2. A URL tells the browser how to connect, which server to ask, which resource to fetch, any extra data, and where on the page to jump.
  • Protocol: https is HTTP made secure with encryption, so nobody on the same Wi-Fi can read or change what you send. Always look for it before typing passwords or M-Pesa details.
  • Domain name: the human-friendly name that DNS turns into an IP address. Endings such as .com, .co.ke or .ug are top-level domains.
  • Path: which file or page on that server you want.
  • Query string: extra name=value data after a ?, often from search boxes and forms.
  • Fragment: the part after # is never sent to the server. The browser uses it to scroll to the element with that id.

HTTP status codes

Every response starts with a three-digit status code. You will meet these often:

CodeMeaningWhen you see it
200 OKSuccessThe page loaded normally
301 Moved PermanentlyRedirectThe page has a new address; the browser follows it automatically
404 Not FoundClient errorThe path does not exist, often a typo or a deleted page
500 Internal Server ErrorServer errorSomething broke in the server's own code

Codes in the 200s mean success, 300s mean redirection, 400s mean the request had a problem and 500s mean the server had a problem.

Static and dynamic sites

A static site sends the same ready-made HTML files to everyone, like a printed menu. A dynamic site builds the HTML on the server for each request, for example showing your name and balance after you log in. Frameworks such as Django build HTML this way. Either way, what arrives in the browser is HTML, which is why learning it well pays off.

Tip

Open your browser's developer tools (F12), choose the Network tab and reload any page. You will see every request the browser makes, with its status code, size and time.

Key points

  • Browsers are clients that request files; servers store websites and send responses.
  • DNS turns domain names into IP addresses before any page is requested.
  • A URL has a protocol, domain, path, and optional query string and fragment.
  • Status codes report the result: 200 success, 301 redirect, 404 not found, 500 server error.
Up next · Getting StartedEditors & Your First PageSet up VS Code and build your first HTML page.
→

Tip: use the ← and → keys to move between pages.