Have you ever wondered what happens behind the scenes when you type a website address into your browser and press Enter?

You enter something like https://example.com, wait a few seconds, and a complete website appears on your screen. It looks simple, but several systems work together to make that happen.

Your browser communicates with DNS servers, establishes network connections, exchanges HTTP requests and responses, processes HTML, CSS, and JavaScript, and finally renders the page.

Let's break down what actually happens.

Part 1: From URL to Server Connection

1. Understanding the URL

A URL (Uniform Resource Locator) is the address used to locate a resource on the internet.

For example:

https://www.example.com:443/products?id=25

A URL contains several components:

Component Example Purpose
Protocol https Defines how communication happens
Subdomain www Identifies a specific section or host
Domain example.com Identifies the website
Port 443 Identifies the network service
Path /products Specifies the requested resource
Query ?id=25 Passes additional information

When you enter a URL, the browser first parses it to understand where you want to go and which communication protocol to use.

2. DNS Resolution: Finding the Server

Computers communicate using IP addresses rather than domain names.

For example, humans can remember:

example.com

But computers need an IP address to locate the destination server.

This is where DNS (Domain Name System) comes in.

DNS works like the internet's phonebook. It translates domain names into IP addresses.

The browser and operating system may first check their existing DNS caches. If the address is not cached, the system queries a DNS resolver.

The resolver can then contact other DNS servers:

  1. Root DNS server
  2. Top-Level Domain (TLD) server
  3. Authoritative DNS server

Eventually, the resolver obtains the IP address associated with the domain.

Example:

nslookup example.com 

This command requests DNS information for example.com.

A simplified DNS lookup might look like this:

Browser | v DNS Cache | v DNS Resolver | v Root DNS Server | v TLD DNS Server | v Authoritative DNS Server | v IP Address Returned 

The browser now knows where to send its request.

3. Establishing a Connection

After obtaining the IP address, the browser needs to establish a connection with the server.

For traditional HTTPS connections over TCP, this involves a process called the TCP Three-Way Handshake.

It consists of three steps:

  1. SYN: The client requests a connection.
  2. SYN-ACK: The server acknowledges the request.
  3. ACK: The client confirms the connection.
CLIENT SERVER | | | -------- SYN ---------------> | | | | <------- SYN-ACK ------------ | | | | -------- ACK ---------------> | | | | Connection Ready | 

For HTTPS, another important process happens: the TLS handshake.

TLS (Transport Layer Security) establishes encryption between the browser and server.

During the TLS handshake:

  • The server presents its digital certificate.
  • The browser validates the certificate.
  • Both sides negotiate cryptographic parameters.
  • They establish shared session keys.

After this process, communication can be encrypted.

Important: Modern browsers may also use HTTP/3, which operates over QUIC instead of TCP. QUIC combines transport and security setup differently.

Part 2: HTTP Requests and Server Processing

4. Sending an HTTP Request

Once the connection is ready, the browser sends an HTTP request to the server.

HTTP stands for Hypertext Transfer Protocol. It defines how clients and servers exchange information.

For example, a browser might send:

GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 Accept: text/html 

Let's understand the components:

  • GET: Requests a resource.
  • /: Requests the homepage.
  • Host: Specifies the destination hostname.
  • User-Agent: Provides information about the browser.
  • Accept: Describes the content types the browser can process.

HTTP supports several request methods:

Method Purpose
GET Retrieve information
POST Submit information
PUT Replace a resource
PATCH Partially update a resource
DELETE Delete a resource
HEAD Retrieve response headers

For a normal website visit, GET is commonly used to request the initial HTML document.

5. What Happens Inside the Server?

The request reaches the web server.

Depending on the website's architecture, the server might use software such as:

  • Nginx
  • Apache HTTP Server
  • Node.js
  • Express.js
  • Python with Flask or Django

The server processes the request and decides what response to return.

For example, consider this basic Node.js server:

const http = require("http"); const server = http.createServer((req, res) => { if (req.url === "/") { res.writeHead(200, { "Content-Type": "text/html" }); res.end("<h1>Welcome to my website!</h1>"); } }); server.listen(3000, () => { console.log("Server running on port 3000"); }); 

When someone requests the homepage, the server returns HTML.

Real applications can perform much more complicated operations:

  1. Authenticate the user.
  2. Validate incoming data.
  3. Retrieve information from a database.
  4. Execute application logic.
  5. Generate a response.
  6. Return the response to the browser.

For example, an online shopping website might retrieve product information from a database before returning the requested page.

6. HTTP Response: The Server Replies

After processing the request, the server sends an HTTP response.

A simplified response looks like this:

HTTP/1.1 200 OK Content-Type: text/html Content-Length: 125 <!DOCTYPE html> <html> <head> <title>Example Website</title> </head> <body> <h1>Hello, World!</h1> </body> </html> 

The response contains three important elements:

Status Line: Indicates the HTTP version and response status.

Headers: Provide additional information about the response.

Body: Contains the requested content, such as HTML, JSON, images, or other resources.

Some common HTTP status codes include:

Status Meaning
200 OK
301 Moved Permanently
302 Found
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
503 Service Unavailable

A 200 OK response generally means the request was successfully handled.

Part 3: How the Browser Builds the Website

7. HTML Parsing and DOM Creation

Receiving HTML does not mean the website is immediately visible.

The browser first parses the HTML document and creates a structure called the DOM (Document Object Model).

The DOM represents the webpage as a tree of objects.

Consider this HTML:

<!DOCTYPE html> <html> <head> <title>My Website</title> </head> <body> <h1>Hello World</h1> <p>Welcome to my website.</p> </body> </html> 

Its simplified DOM structure looks like this:

Document | HTML | |---- HEAD | | | |---- TITLE | |---- BODY | |---- H1 | |---- P 

JavaScript can interact with this structure to change webpage content dynamically.

For example:

document.querySelector("h1").textContent = "Website Loaded!"; 

This changes the heading without requiring the browser to download an entirely new HTML document.

8. CSS Processing and the CSSOM

HTML defines the structure of a webpage, but CSS controls its appearance.

When the browser encounters CSS, it parses the stylesheet and creates another structure called the CSSOM (CSS Object Model).

Consider:

body { background-color: black; color: white; font-family: Arial, sans-serif; } h1 { color: red; text-align: center; } 

The browser combines information from the DOM and CSSOM to determine how elements should appear.

This process helps calculate:

  • Text colours
  • Background colours
  • Font sizes
  • Element positions
  • Margins and padding
  • Layout dimensions

9. JavaScript Execution

JavaScript makes websites interactive.

It can:

  • Handle button clicks.
  • Validate forms.
  • Fetch information from APIs.
  • Update webpage content.
  • Create animations.
  • Manage application state.

For example:

const button = document.querySelector("button"); button.addEventListener("click", () => { alert("Button clicked!"); }); 

Modern browsers use JavaScript engines to execute JavaScript code.

Some popular engines include:

  • V8 (Chrome and other Chromium-based browsers)
  • SpiderMonkey (Firefox)
  • JavaScriptCore (Safari)

The browser may execute JavaScript while parsing and rendering the page. Scripts can also affect when other resources are processed, depending on how they are loaded.

10. Layout, Painting, and Compositing

The browser now has the information needed to display the webpage.

It performs several rendering operations:

Layout: Calculates the size and position of elements.

Painting: Draws visual properties such as text, backgrounds, borders, and shadows.

Compositing: Combines different visual layers into the final displayed image.

The simplified rendering pipeline looks like this:

HTML | v DOM | | CSS | v CSSOM | v Render Tree | v Layout | v Painting | v Compositing | v Webpage Displayed 

The browser also downloads additional resources, including images, fonts, stylesheets, and scripts, when required.

Some resources may load in parallel, while others depend on earlier processing.

11. The Complete Journey

Let's connect everything together.

When you enter:

https://example.com

The following simplified sequence takes place:

1. User enters a URL | v 2. Browser parses the URL | v 3. DNS resolves the domain | v 4. Browser establishes a connection | v 5. TLS secures the connection | v 6. Browser sends HTTP request | v 7. Server processes the request | v 8. Server returns HTTP response | v 9. Browser parses HTML and CSS | v 10. JavaScript is executed | v 11. Browser calculates layout | v 12. Browser paints and composites | v 13. Website appears on screen 

This is a simplified model. Modern browsers and network protocols can overlap or rearrange several of these operations.

Conclusion

Entering a URL is much more than opening a website.

It triggers a chain of operations involving DNS, networking, encryption, HTTP communication, server-side processing, browser engines, and rendering systems.

Every time you visit a website, your browser coordinates with multiple technologies to turn a simple address into a working webpage.

The next time you press Enter, remember that a considerable amount of engineering happens before the page even appears.

The internet may look simple from the outside, but the systems behind it are anything but simple.