Cybersecurity

How Websites Actually Work: DNS, HTTPS, Servers and Browsers

Python JavaScript AI Agents Encryption Databases SQL Redis HTML CSS Node.js Java Certificates TLS HTTPS
863 words Includes Code
Key Takeaway: Every website visit involves six stages — URL parsing, DNS resolution, TCP connection, TLS encryption, HTTP request/response, and browser rendering — all completing in under a second. Understanding this journey is fundamental to web development, security, and debugging.

How Websites Actually Work: DNS, HTTPS, Servers and Browsers

You type a URL, press Enter, and a page appears. But what actually happens between those two moments? This article traces the complete journey from URL to rendered page — DNS resolution, TCP handshake, TLS encryption, HTTP request/response, server processing, and browser rendering.

This is the foundation every web developer, security engineer, and network administrator needs to understand.

Complete website journey showing URL, DNS, TCP, TLS, HTTP, server processing and browser rendering with timing measurements

Step 1: URL Parsing

When you type https://bestwordz.com/articles/ and press Enter, your browser first decomposes the URL:

https://bestwordz.com:443/articles/
│         │              │    │
│         │              │    └─ Path (which page)
│         │              └────── Port (443 = HTTPS)
│         └───────────────────── Hostname (domain name)
└─────────────────────────────── Scheme (https = encrypted)

The scheme tells the browser to use HTTPS (encrypted). The hostname identifies the server. The port defaults to 443 for HTTPS. The path identifies the specific page.

Step 2: DNS Resolution (Domain → IP Address)

Computers don't understand domain names — they need IP addresses. DNS (Domain Name System) translates bestwordz.com into an IP address like 145.79.24.188.

# DNS resolution in action
$ nslookup bestwordz.com
Server:    8.8.8.8
Address:   8.8.8.8#53

Non-authoritative answer:
Name:      bestwordz.com
Address:   145.79.24.188
Address:   145.79.29.75

DNS record types you should know:

RecordPurposeExample
AMaps domain to IPv4 addressexample.com → 93.184.216.34
AAAAMaps domain to IPv6 addressexample.com → 2606:2800:220:1:...
CNAMEAliases one domain to anotherwww → example.com
MXMail server for domainmail.example.com (priority 10)
TXTText records (SPF, DKIM, verification)v=spf1 include:_spf.google.com ~all

DNS responses are cached at multiple levels: browser, operating system, router, and ISP. First visit may take 50-200ms; cached visits take under 5ms.

Step 3: TCP Connection (Three-Way Handshake)

Before any data flows, the browser and server establish a reliable connection using TCP's three-way handshake:

Browser                                    Server
  │                                          │
  │──── SYN (seq=1000) ──────────────────→│  ① "I want to connect"
  │                                          │
  │←─── SYN-ACK (seq=3000, ack=1001) ──────│  ② "OK, I acknowledge"
  │                                          │
  │──── ACK (ack=3001) ──────────────────→│  ③ "Connection confirmed"
  │                                          │
  │          TCP Connection Open             │

Key details:

  • Source port: Random high port (e.g., 52847) chosen by your browser
  • Destination port: 443 (HTTPS) or 80 (HTTP)
  • Sequence numbers: Ensure packets arrive in order
  • Typical time: 20-80ms depending on geographic distance

Step 4: TLS Handshake (HTTPS Encryption)

After TCP connects, TLS creates an encrypted tunnel. This is what makes HTTPS secure:

Browser                                        Server
  │                                              │
  │── ClientHello: TLS 1.3, cipher list ────→│  ① Supported versions
  │                                              │
  │←── ServerHello: chosen cipher + cert ─────│  ② Certificate + choice
  │                                              │
  │    [Verify certificate chain]              │  ③ Browser validates cert
  │    [Check domain matches]                  │
  │                                              │
  │── Finished: encrypted verify ────────────→│  ④ Encrypted handshake
  │                                              │
  │←── Finished: encrypted verify ────────────│  ⑤ Server confirms
  │                                              │
  │           Encrypted tunnel open              │

What was measured from bestwordz.com:

PropertyValue
TLS VersionTLSv1.3
Cipher SuiteTLS_AES_256_GCM_SHA384
Certificate IssuerLet's Encrypt
Domains Coveredbestwordz.com, www.bestwordz.com
ExpiresOctober 10, 2026

Step 5: HTTP Request and Response

With the encrypted tunnel open, the browser sends an HTTP request:

# HTTP Request
GET /articles/ HTTP/2
Host: bestwordz.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml
Accept-Language: en-US,en;q=0.9
Accept-Encoding: gzip, deflate, br
Cookie: session_id=abc123...

# HTTP Response
HTTP/2 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 45238
Server: hcdn
Cache-Control: public, max-age=3600

<!DOCTYPE html>
<html lang="en">
  <head>...</head>
  <body>...</body>
</html>

HTTP/2 brings significant improvements over HTTP/1.1:

FeatureHTTP/1.1HTTP/2
MultiplexingOne request per connectionMultiple parallel streams
Header CompressionUncompressedHPACK compression
Server PushNot supportedServer can push resources
Binary ProtocolText-basedBinary (faster parsing)

Step 6: Server Processing

The server receives the request and processes it through multiple layers:

① Reverse Proxy (Nginx / Caddy)
   └─ Receives request, terminates TLS
   └─ Routes to appropriate backend

② Application (Python / Node.js / Go)
   └─ Parses URL and parameters
   └─ Authenticates user (if needed)
   └─ Queries database
   └─ Renders HTML template
   └─ Adds security headers

③ Database (PostgreSQL / MySQL / Redis)
   └─ Retrieves requested data
   └─ Returns results to application

④ Response
   └─ HTTP 200 OK
   └─ Compressed HTML (gzip/brotli)
   └─ Cache headers
   └─ Security headers
Complete HTTP request sequence diagram showing DNS, TCP, TLS, HTTP phases with timing

Step 7: Browser Rendering

The browser receives HTML and transforms it into visible pixels through a multi-stage pipeline:

StageWhat HappensOutput
Parse HTMLRead HTML tokens, build element treeDOM tree
Load CSSDownload, parse, apply stylesCSSOM tree
Execute JSRun scripts, modify DOM/CSSOMUpdated DOM
Render TreeCombine DOM + CSSOM (visible only)Render tree
LayoutCalculate positions and sizesGeometry data
PaintDraw text, colors, images, bordersPixel layers
CompositeLayer ordering, GPU accelerationVisible page
Performance tip: JavaScript blocks HTML parsing. Place <script> tags at the bottom of <body> or use defer/async attributes to avoid blocking the render pipeline.

Complete Timing Breakdown

Measured from a real visit to bestwordz.com:

StageTypical TimeWhat Happens
DNS~5ms (cached)Domain → IP lookup
TCP~30msThree-way handshake
TLS~50msCertificate verification + key exchange
HTTP~200-740msServer processing + response transfer
Render~50-200msDOM + CSSOM + Layout + Paint
Total~300-1000msURL entry to visible page

What Can Go Wrong

StageProblemSymptom
DNSDomain not registeredDNS_PROBE_FINISHED_NXDOMAIN
DNSDNS server downDNS resolution timeout
TCPFirewall blocking port 443Connection timeout
TLSExpired certificateNET::ERR_CERT_DATE_INVALID
TLSDomain mismatchNET::ERR_CERT_COMMON_NAME_INVALID
HTTPServer error500 Internal Server Error
HTTPPage not found404 Not Found
RenderJavaScript errorBlank page or broken layout

Try It Yourself — BestWordz Tools

Related BestWordz Articles

Summary

Every website visit follows the same six-stage journey:

  1. URL Parsing — Browser decomposes scheme, host, port, path
  2. DNS Resolution — Domain name translated to IP address (~5ms)
  3. TCP Handshake — Reliable connection established (~30ms)
  4. TLS Handshake — Encrypted tunnel created (~50ms)
  5. HTTP Request/Response — Request sent, HTML received (~200-740ms)
  6. Browser Rendering — DOM → CSSOM → Layout → Paint → Visible (~50-200ms)

Total time: under one second for most websites. Understanding this journey is the foundation for web development, security debugging, performance optimization, and network troubleshooting.

Further Reading

Discuss this topic on BestWordz Community — Share your web development questions, debug network issues, and learn from other developers understanding how the web works.

Try the URL Encoder

Put what you've learned into practice with this free BestWordz tool.

Open Tool →

💬 Discuss on BestWordz Community

Join the conversation about Python, JavaScript, AI Agents on the BestWordz Community forum.

Visit Forum →