A website is a set of files and programs kept on a computer called a web server. When you open a site, your browser asks that server for the page, the server sends the files back, and your browser turns them into what you see on the screen. On a good connection, all of this often takes less than a few seconds.
This page follows one page load from start to end, using a restaurant to explain each step. No coding knowledge is needed.
The restaurant analogy
Imagine you walk into a restaurant.
| At the restaurant | On the web |
|---|---|
| You, the customer | You, the user |
| The waiter who takes your order | Your browser (Chrome, Edge, Firefox, Safari) |
| The restaurant's address | The website's IP address |
| Asking someone for the address by name | DNS looking up the address |
| Your order | The request |
| The kitchen | The web server and backend |
| The store room with ingredients | The database |
| The plate of food brought to you | The response |
| How the food is arranged on the plate | HTML, CSS and JavaScript shaping the page |
You never walk into the kitchen. You tell the waiter what you want, and the food comes out ready. On the web, you never touch the server. Your browser asks for you, and the page comes back.
What happens when you type a URL
Say you type https://www.example.com/about and press Enter. Here are the steps.
1. The browser reads the address
A URL has parts:
| Part | In the example | Meaning |
|---|---|---|
| Protocol | https:// |
The rules for talking to the server |
| Domain | www.example.com |
The name of the website |
| Path | /about |
Which page you want |
2. DNS finds the server's address
Computers find each other by numbers called IP addresses, such as 203.0.113.10. People remember names better than numbers. DNS (Domain Name System) is the internet's phone book. It turns the name www.example.com into the IP address of the server.
Your computer often remembers recent answers, so this step can be very quick on a second visit.
3. The browser connects to the server
Using the IP address, the browser opens a connection to the server. For HTTPS, the two sides also agree on encryption keys so the conversation is private. This is done with a protocol called TLS.
4. The browser sends a request
The request is a short text message. A simplified one looks like this:
GET /about HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html
GET means "please give me". /about is the page. The other lines tell the server more about the browser and what it can accept.
5. The server prepares a response
The web server receives the request. Two things can happen:
- Static page: the file already exists, such as
about.html. The server sends it as it is. - Dynamic page: a program on the server builds the page for you. For example, it may read your name and orders from a database and put them into the page.
6. The server sends a response
The response starts with a status code, then some details, then the content:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
<head>
<title>About Us</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<h1>About Us</h1>
<p>We teach coding to students.</p>
<script src="/app.js"></script>
</body>
</html>
200 OK means "here is what you asked for".
7. The browser asks for more files
The HTML mentions other files: style.css, app.js and maybe images and fonts. The browser sends a new request for each of them. A single modern page can need dozens of files.
8. The browser draws the page
Finally, the browser puts it all together:
| File type | Job | Restaurant version |
|---|---|---|
| HTML | Structure and content: headings, text, links, images | The food items on the plate |
| CSS | Look and layout: colours, fonts, spacing | How the plate is arranged and decorated |
| JavaScript | Behaviour: menus that open, forms that check input | The waiter who reacts when you ask for more |
You can see these files yourself. Right-click any page and choose "View page source" to see its HTML. Our HTML tutorial teaches you to write your own.
Common status codes
| Code | Meaning | When you see it |
|---|---|---|
| 200 OK | Success | Normal page load |
| 301 Moved Permanently | The page has a new address | Old links that redirect |
| 404 Not Found | No page at this address | A typo in the URL or a deleted page |
| 403 Forbidden | You are not allowed to see this | Private areas |
| 500 Internal Server Error | Something broke on the server | A bug in the backend code |
Codes starting with 2 mean success, 3 means redirect, 4 means a problem with the request and 5 means a problem on the server.
What is a web server
The word "web server" means two things:
- The computer that stores the website and is always connected to the internet.
- The software on that computer that listens for requests and sends responses. Nginx and Apache HTTP Server are two widely used examples.
A web server is just a computer. You can even run one on your own laptop while learning. Companies usually rent servers from hosting or cloud providers such as AWS, Microsoft Azure or Google Cloud, so the site stays online all day.
Browser and server explained: the client-server model
The web follows a client-server model:
- The client asks. Your browser or a mobile app is the client.
- The server answers. It waits for requests and replies to each one.
One server can answer thousands of clients. One client can talk to many servers. A single news page might load text from one server, images from another and ads from a third.
Frontend and backend basics
A website has two halves.
| Frontend | Backend | |
|---|---|---|
| Runs on | Your browser | The server |
| You can see it? | Yes, it is what you look at and click | No, it works behind the scenes |
| Main jobs | Layout, design, buttons, forms | Logins, saving data, payments, business rules |
| Common tools | HTML, CSS, JavaScript, React | Java with Spring Boot, Python with Django, Node.js |
| Restaurant version | The dining area and the plate | The kitchen and the store room |
When you log in to a site, the frontend shows the form. The backend checks your password against the database and decides whether to let you in. Read frontend vs backend for a full comparison of the two career paths.
Where the database fits
The backend stores data in a database: users, products, orders, messages. When a page needs data, the backend asks the database, gets the result and puts it into the response. The software that runs the database is called a DBMS. Our guide on what a DBMS is explains it.
Browser --request--> Web server / backend --query--> Database
Browser <--response-- Web server / backend <--data--- Database
Where APIs fit
Many modern sites do not send a full page every time. The page loads once, then JavaScript asks the server only for the data it needs, such as new messages, and updates part of the page. The server part that answers these data requests is an API. Our guide on what an API is explains this with a waiter example too.
HTTP vs HTTPS
| HTTP | HTTPS | |
|---|---|---|
| Encryption | None | Yes, using TLS |
| Default port | 80 | 443 |
| Browser shows | "Not secure" in many browsers | A padlock or similar icon |
| Safe for passwords and payments | No | Yes |
Always check for HTTPS before typing a password or card number.
GET and POST in one line each
- GET asks for something, such as a page or search results. The details can appear in the URL.
- POST sends something, such as a filled form. The details travel in the body of the request.
See GET vs POST for when to use each.
The whole journey in one list
- You type a URL and press Enter.
- DNS turns the domain name into an IP address.
- The browser connects to the server, with encryption for HTTPS.
- The browser sends a request.
- The server finds or builds the page, maybe using a database.
- The server sends a response with a status code and HTML.
- The browser requests CSS, JavaScript and images.
- The browser draws the page, and JavaScript makes it interactive.
Interview note: "What happens when you type a URL in the browser?" is a common fresher interview question. Answer in the order above, and mention DNS, the request, the response and rendering by name.
Try it yourself
- Open any website, press F12 and open the Network tab. Reload the page. You will see every request the browser makes, with its status code.
- Right-click the page and choose View page source to see the HTML.
- Create a file named
index.html, type a heading and a paragraph, and open it in your browser. You have made a web page.
Want to build websites as a job? Our how to become a web developer guide lays out the skills to learn, starting with HTML, CSS and JavaScript.
Going further with web development? Compare HTML vs HTML5 and React vs Vue before you pick your first frontend tools.
Frequently Asked Questions
How does a website work in simple words?
What is a web server?
What is DNS?
What is the difference between frontend and backend?
What is the difference between HTTP and HTTPS?
Want to Build Your Career in Java Full Stack with AI?
Join CodeBegun and train with working industry engineers — See the Java Full Stack course in Hyderabad

