How Does a Website Work? DNS, HTTP and Servers Explained Simply

Follow one request from the address bar to a rendered page: URLs, DNS, HTTPS, HTTP requests and responses, servers, databases and browser rendering — in plain language.

AD Admin PenduCoder 7 min read
How Does a Website Work? DNS, HTTP and Servers Explained Simply
On this page

You type penducoder.com, press Enter, and less than a second later a full page appears. In that second, your computer has asked for directions, opened a secure connection to a machine possibly thousands of kilometres away, sent a request, received code, and turned that code into what you see. Understanding this journey is the single most useful thing a new web developer can learn — every framework, every bug and every performance trick builds on it.

Let's follow one request from start to finish, in plain language, with the actual messages your browser sends.

The short version

  1. URL — you tell the browser which site and which page you want.
  2. DNS — the browser looks up the server's IP address, like looking up a phone number.
  3. Connection — the browser connects to the server and sets up encryption (HTTPS).
  4. HTTP request — the browser asks for the page.
  5. Server work — the server finds or builds the page, often using a database.
  6. HTTP response — the server sends back HTML plus a status code.
  7. Rendering — the browser downloads CSS, JavaScript and images, then draws the page.

1. You type a URL

A URL (Uniform Resource Locator) is an address with several parts:

https://penducoder.com/blog/system-design-basics?ref=home
└─┬─┘   └─────┬─────┘└──────────┬───────────┘└──┬───┘
protocol    domain            path           query string
  • Protocol — https means "talk securely using HTTP".
  • Domain — the human-friendly name of the website.
  • Path — which page or resource on that site.
  • Query string — extra information such as search terms or tracking tags.

2. DNS finds the server's address

Computers find each other by IP address (like 104.21.32.15), not by name. The Domain Name System (DNS) is the internet's phone book that converts names to numbers.

Your browser first checks its own memory (cache), then the operating system's, then asks a DNS resolver — usually run by your internet provider or a public one like Cloudflare's 1.1.1.1 or Google's 8.8.8.8. If the resolver does not know, it asks the root servers, then the .com servers, then the domain's own nameservers, which finally return the answer.

# Try it yourself
nslookup penducoder.com
# or on Linux/macOS
dig penducoder.com +short

When you buy a domain and "point it to your server", you are creating an A record in DNS: this name → this IP address. DNS answers are cached for a time set by the record's TTL, which is why DNS changes can take a while to reach everyone.

3. The browser connects securely

With the IP address in hand, the browser opens a connection to the server — on port 443 for HTTPS. Then comes the TLS handshake: the server proves its identity with an SSL/TLS certificate issued by a trusted authority (Let's Encrypt, for example), and both sides agree on encryption keys. From this point, nobody in between — not the café Wi-Fi, not your provider — can read or change the data. That is what the padlock in the address bar means.

4. The browser sends an HTTP request

HTTP (HyperText Transfer Protocol) is the language browsers and servers speak. A request is surprisingly readable:

GET /blog/system-design-basics HTTP/1.1
Host: penducoder.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...
Accept: text/html
Accept-Language: en-US,en;q=0.9
Cookie: session=abc123...

The first word is the method — what you want to do:

MethodMeaningExample
GETRead somethingOpen a blog post
POSTCreate something / submit dataSubmit a contact form
PUT / PATCHUpdate somethingEdit your profile
DELETERemove somethingDelete a comment

Headers carry extra details: which site you want (one server can host many), your language, and cookies — small pieces of data that let the server remember you are logged in.

5. The server prepares the response

The request arrives at a web server such as Nginx or Apache. What happens next depends on the site:

  • Static file — for an image, a CSS file or a plain HTML page, the web server simply reads the file from disk and sends it back. Very fast.
  • Dynamic page — for a blog post, a dashboard or a shop, the web server hands the request to an application written in PHP (Laravel, WordPress), Python (Django), JavaScript (Node.js) or similar. The application checks who you are, runs queries against a database like MySQL, fills a template with the results, and produces HTML.
Browser → Nginx → PHP-FPM → Laravel app → MySQL
                                 ↓
Browser ←──────── HTML ←─────────┘

6. The server sends an HTTP response

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Cache-Control: max-age=600
Set-Cookie: session=abc123; HttpOnly; Secure

<!DOCTYPE html>
<html>...the page...</html>

The status code tells the browser how it went:

CodeMeaning
200 OKSuccess, here is your page.
301 / 302Moved — go to this other URL instead.
304 Not ModifiedUse the copy you already cached.
404 Not FoundThat page does not exist.
403 ForbiddenYou are not allowed to see this.
500 Internal Server ErrorThe application crashed.
502 / 503The server behind the web server is down or overloaded.

7. The browser renders the page

The HTML is just the beginning. The browser reads it top to bottom, finds links to CSS files, JavaScript files, fonts and images, and requests each of them — often dozens of extra requests. Then it:

  1. Builds the DOM (a tree of every element on the page) from the HTML.
  2. Applies CSS to work out colours, sizes and positions.
  3. Runs JavaScript, which can change the page, respond to clicks and load more data in the background.
  4. Paints the pixels on screen.

This is why large images and heavy JavaScript make sites feel slow — the browser has to download and process them before the page is ready. Google measures this experience with Core Web Vitals.

See it yourself: open any site, press F12, go to the Network tab and reload. Every row is one request, with its method, status code, size and time.

Static vs dynamic websites

StaticDynamic
How pages are madePre-built HTML filesBuilt on each request by an app
ExamplesPortfolio, landing page, documentationShop, social network, dashboard, blog with comments
Speed and costVery fast, cheap or free hostingNeeds a server, database and maintenance
Personalised contentNo (without JavaScript and APIs)Yes — logins, carts, recommendations

Frontend, backend and database

  • Frontend — everything that runs in the browser: HTML for structure, CSS for design, JavaScript for interaction.
  • Backend — code on the server that handles requests, business rules, security and talking to the database. Choosing your first backend? See Laravel vs Node.js.
  • Database — where data lives permanently: users, posts, orders.

Why this matters when you build with AI

AI tools can generate a whole website in minutes, but when something breaks, they cannot see your DNS records, your server logs or your browser's Network tab — you can. Knowing whether a problem is DNS (the site does not load at all), a 404 (wrong path or route), a 500 (application error) or slow rendering (heavy assets) tells you exactly where to look and what to ask the AI. More on this in why fundamentals still matter.

FAQ

What is the difference between the internet and the web?

The internet is the global network of connected computers. The web is one service that runs on it — websites accessed with browsers over HTTP. Email and online games also use the internet but are not "the web".

What is the difference between HTTP and HTTPS?

HTTPS is HTTP inside an encrypted TLS connection. It protects passwords and data from being read or modified in transit, and browsers mark plain HTTP sites as "Not secure".

What is a web host?

A company that rents you a computer (server) that is always online, where your website's files, application and database live.

Recap

URL → DNS → secure connection → HTTP request → server and database → HTTP response → rendering. Once this chain is clear in your head, debugging becomes logical instead of magical. Next, see how this one-server picture grows to millions of users in System Design Basics, or follow the full web development roadmap.

Found this useful? Share it

AD

Admin PenduCoder

Full-stack developer and educator. Writes about Laravel, Next.js, applied AI and the unglamorous parts of shipping software.

Get in touch →
Chat with us