π What REALLY Happens When You Type a URL?
You type:
https://example.com
You press:Enter
And somehow: a complete webpage appears in milliseconds.But what actually happened between those two events?
This article follows the journey of a URL from your keyboard β browser β DNS β network β server β browser β pixels on your screen.
π§ The Big Picture
At a very high level:
You type a URL
β
Browser parses the URL
β
Check browser cache
β
DNS: "What IP belongs to this domain?"
β
Get IP address
β
Establish connection
β
TLS handshake (HTTPS)
β
HTTP request
β
Server processes request
β
HTTP response
β
Browser receives HTML
β
Download CSS / JavaScript / Images
β
Build DOM + CSSOM
β
Layout + Paint + Composite
β
π¨ Webpage appears
And this can happen incredibly quickly.
1. π First: What Exactly Is a URL?
A URL (Uniform Resource Locator) tells your browser where a resource is and how to access it.
Consider:
https://www.example.com:443/products?id=42#reviews
Let's break it apart.
| Component | Value | Purpose |
|---|---|---|
| Scheme | https |
Protocol |
| Host | www.example.com |
Website/domain |
| Port | 443 |
Network port |
| Path | /products |
Resource location |
| Query | ?id=42 |
Additional parameters |
| Fragment | #reviews |
Position inside page |
π§© URL Anatomy
https://www.example.com:443/products?id=42#reviews
βββ¬ββ ββββββ¬βββββββ ββ¬β ββββββ¬βββββ ββββ¬ββββ
scheme host port query fragment
π‘ Important
The browser does not immediately connect to:
www.example.com
Computers communicate using IP addresses.
So eventually we need something like:
www.example.com
β
93.184.216.34
And that's where DNS enters the story.
2. π§ The Browser First Parses the URL
When you press Enter, the browser first determines what you've entered.
For example:
https://example.com/products
The browser understands:
Protocol β HTTPS
Host β example.com
Path β /products
Port β 443
The browser now knows:
βI need to retrieve
/productsfromexample.comusing HTTPS.β
But it still doesn't know where example.com actually lives.
3. β‘ Before DNS: Check the Cache
Your browser may already know the answer.
Modern browsers and operating systems maintain several caches.
A simplified hierarchy looks like:
Browser DNS Cache
β
Operating System Cache
β
Hosts File
β
Configured DNS Resolver
β
Root DNS
β
TLD DNS
β
Authoritative DNS
If the IP is already cached and hasn't expired:
example.com
β
Cached IP
β
Skip DNS lookup
This is one reason why repeatedly visiting a website can feel faster.
4. π DNS β The Internet's Phone Book
What is DNS?
DNS = Domain Name System
Humans prefer:
google.com
Computers ultimately need:
142.250.x.x
DNS translates the domain name into an IP address.
DNS
β
βΌ
"Where is example.com?"
β
βΌ
93.184.216.34
5. π³ How DNS Actually Finds the IP
Here's where things get interesting.
Suppose your DNS resolver doesn't already know the answer.
It can walk through the DNS hierarchy.
flowchart TD
A["Browser"] --> B["DNS Resolver"]
B --> C["Root DNS Server"]
C --> D[".com TLD Server"]
D --> E["Authoritative DNS Server"]
E --> F["IP Address"]
F --> B
B --> A
Step 1 β Ask the Resolver
Your computer asks its configured DNS resolver:
What is the IP address of example.com?
The resolver might be operated by:
- your ISP
- your organization
- a public DNS service
- another DNS provider
Step 2 β Root DNS
If the resolver doesn't know, it can ask a root DNS server.
The root doesn't usually know the final IP.
Instead, it says approximately:
βI don't know
example.com, but I know who handles.com.β
Root
β
.com TLD
Step 3 β TLD Server
The resolver asks the .com TLD server:
Who is authoritative for example.com?
The TLD server points toward the domain's authoritative DNS servers.
.com
β
Authoritative DNS
Step 4 β Authoritative DNS
Finally:
Authoritative DNS
β
example.com
β
93.184.216.34
The resolver returns the answer to your computer.
6. π§ DNS Records
DNS isn't just about IP addresses.
A domain can have different record types.
| Record | Purpose |
|---|---|
A |
IPv4 address |
AAAA |
IPv6 address |
CNAME |
Alias to another hostname |
MX |
Mail server |
TXT |
Text / verification / policy data |
NS |
Authoritative nameserver |
CAA |
Certificate authority authorization |
For example:
example.com
β
βββ A β IPv4
βββ AAAA β IPv6
βββ MX β Mail server
βββ TXT β Verification / policy
7. π TTL β Why DNS Doesn't Happen Every Time
DNS records have a TTL (Time To Live).
Example:
example.com
A β 93.184.216.34
TTL β 300 seconds
A resolver can cache the answer for that period.
So the next request may become:
Browser
β
Cached DNS result
β
IP
instead of:
Browser
β
Resolver
β
Root
β
TLD
β
Authoritative DNS
β
IP
8. π We Now Have an IP Address
Great!
Suppose DNS returned:
93.184.216.34
Now the browser knows:
βThat's the machine I need to communicate with.β
But there's another question:
How do we establish the connection?
For HTTPS, traditionally this involves TCP + TLS.
For HTTP/3, it can instead use QUIC over UDP.
Let's first understand the classic TCP path.
9. π€ TCP β Establishing a Connection
TCP provides a reliable connection between two endpoints.
Before sending application data, TCP traditionally performs the famous:
Three-Way Handshake
Client Server
β β
β -------- SYN ---------------> β
β β
β <------- SYN + ACK ---------- β
β β
β -------- ACK ---------------> β
β β
β Connection ready β
What do these mean?
SYN
βI want to start a TCP connection.β
SYN-ACK
βI received your request and I'm willing to connect.β
ACK
βGot it.β
Now the TCP connection is established.
10. π HTTPS Changes the Story
If the URL is:
https://example.com
we need encryption.
That's what TLS provides.
Without HTTPS:
Browser ββββββββββββββββ> Server
HTTP
With HTTPS:
Browser ββββββββββββββββ> Server
Encrypted
11. π TLS Handshake
TLS allows the browser and server to establish cryptographic parameters and authenticate the server.
A simplified TLS 1.3 flow:
sequenceDiagram
participant B as Browser
participant S as Server
B->>S: ClientHello
S->>B: ServerHello
S->>B: Certificate
S->>B: Handshake messages
B->>S: Finished
S->>B: Finished
Note over B,S: Encrypted application data
The exact wire exchange is more detailed, but conceptually:
Browser
β
β "Here are the cryptographic options I support."
βΌ
Server
β
β "Let's use these."
β
β "Here's my certificate."
βΌ
Browser
β
β Verify certificate
βΌ
Secure session established
12. πͺͺ What's the Certificate For?
When you visit:
https://example.com
your browser wants to know:
βAm I really talking to example.com?β
The server presents a digital certificate.
The certificate contains information such as the domain names it covers and cryptographic identity information.
It is signed through a chain involving trusted Certificate Authorities (CAs).
Simplified:
Certificate
β
βΌ
Trusted CA
β
βΌ
Browser's trust store
β
βΌ
"Can I trust this identity?"
If certificate validation fails, the browser may show a security warning.
13. π Is the Data Now Encrypted?
After the TLS handshake:
Browser
β
β π Encrypted
β
βΌ
Server
Someone observing the network generally cannot simply read the HTTPS request contents.
However, HTTPS does not make you invisible.
Depending on the circumstances, information such as destination IP addresses and some connection metadata can still be observable.
14. π¦ Now Comes HTTP
Finally, we can send the actual web request.
For example:
GET /products HTTP/1.1
Host: example.com
Accept: text/html
Accept-Language: en-US
Conceptually:
GET
β
/products
β
example.com
β
"Please give me this resource."
With HTTP/2 or HTTP/3, the wire representation is different from this textual HTTP/1.1 example, but the application-level idea remains similar.
15. π¬ What Is an HTTP Request?
An HTTP request contains several important pieces.
βββββββββββββββββββββββββββββββ
β Method β
β URL / Path β
β Headers β
β Body (optional) β
βββββββββββββββββββββββββββββββ
Common HTTP methods:
| Method | Typical purpose |
|---|---|
GET |
Retrieve data |
POST |
Submit/create data |
PUT |
Replace data |
PATCH |
Partially update data |
DELETE |
Delete data |
When loading a webpage, the initial navigation is commonly a GET.
16. π¨ HTTP Request Example
GET / HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Accept: text/html
Accept-Language: en-US
Think of it as:
βServer, give me the homepage.β
17. π’ But Where Did Our Request Actually Go?
This is an important part people often skip.
The IP address may not represent the actual application server.
Modern websites can sit behind infrastructure such as:
Internet
β
βΌ
CDN / Edge
β
Load Balancer
β
ββββββββββΌβββββββββ
βΌ βΌ βΌ
Server A Server B Server C
β β β
ββββββββββΌβββββββββ
βΌ
Database
Your request may pass through several layers.
18. π CDN β The Website May Be Closer Than You Think
A CDN (Content Delivery Network) places cached content at locations around the world.
Instead of:
India
β
βββββββββββββββ> US Server
you might get:
India
β
βΌ
Nearby CDN Edge
β
βΌ
Cached Content
This reduces latency for cacheable resources.
19. βοΈ Load Balancer
Suppose millions of users visit a website.
One server may not be enough.
A load balancer can distribute requests:
flowchart LR
U["Users"] --> L["Load Balancer"]
L --> A["Server A"]
L --> B["Server B"]
L --> C["Server C"]
A --> D["Database"]
B --> D
C --> D
The browser doesn't necessarily know which backend server handled the request.
20. π§ The Server Starts Working
The server receives:
GET /
Now application code may execute.
For example:
Request
β
Web server
β
Application
β
Authentication
β
Business logic
β
Database
β
Response
Imagine an e-commerce website.
Your request:
GET /products/42
could cause the application to:
1. Authenticate session
2. Validate product ID
3. Query database
4. Fetch product information
5. Render HTML
6. Return response
21. ποΈ Database
The server may need information from a database.
For example:
SELECT *
FROM products
WHERE id = 42;
The database returns something like:
Product
ββββββββββββββ
id: 42
name: Laptop
price: βΉ79,999
stock: 12
The application uses this information to generate the response.
22. π¨ The Server Sends an HTTP Response
The server might respond:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: ...
followed by the HTML document.
Conceptually:
Browser
β
β GET /
βΌ
Server
β
β 200 OK + HTML
βΌ
Browser
23. π¦ HTTP Status Codes
The response has a status code.
| Code | Meaning |
|---|---|
200 |
OK |
201 |
Created |
301 |
Permanent redirect |
302 |
Temporary redirect |
304 |
Not modified |
400 |
Bad request |
401 |
Authentication required |
403 |
Forbidden |
404 |
Not found |
500 |
Server error |
502 |
Bad gateway |
503 |
Service unavailable |
So when you see:
404
the browser did communicate with a server.
The server is essentially saying:
βI don't have the resource you requested.β
24. π The Browser Receives HTML
Now the browser finally has something to work with.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>Hello World</h1>
<p>Welcome!</p>
</body>
</html>
But the page isn't finished yet.
The HTML may reference:
style.css
app.js
logo.png
font.woff2
So the browser starts requesting those resources too.
25. πΈοΈ One Page Can Trigger Many Requests
This is something you can demonstrate beautifully in your video.
You type:
example.com
But the browser may request:
GET /
GET /style.css
GET /app.js
GET /logo.svg
GET /font.woff2
GET /api/user
GET /products
...
One URL can therefore trigger dozens or hundreds of network requests on a modern site.
26. π The Browser Builds the DOM
The browser parses HTML and constructs the:
DOM β Document Object Model
HTML:
<body>
<h1>Hello</h1>
<p>World</p>
</body>
Becomes conceptually:
flowchart TD
A["Document"] --> B["html"]
B --> C["body"]
C --> D["h1"]
C --> E["p"]
D --> F["Hello"]
E --> G["World"]
The DOM represents the document as a tree.
27. π¨ CSSOM
CSS is parsed separately.
Example:
h1 {
color: blue;
font-size: 40px;
}
The browser builds a structure called the:
CSSOM β CSS Object Model
Conceptually:
HTML
β
DOM
CSS
β
CSSOM
Then the browser combines the information to determine what should be rendered.
28. π§± Render Tree
The browser uses the DOM and CSS information to determine what is rendered.
A simplified pipeline:
HTML
β
DOM
β
ββββββββββββββββ
CSS β β CSSOM β
ββββββββ¬ββββββββ
β
Render Tree
β
Layout
β
Paint
β
Composite
β
π₯οΈ Screen
29. π Layout
The browser calculates where everything should appear.
For example:
Viewport
ββββββββββββββββββββββββββββββββ
β Header β
ββββββββββββββββββββββββββββββββ€
β β
β Hello World β
β β
β [ Button ] β
β β
ββββββββββββββββββββββββββββββββ
It calculates:
- width
- height
- position
- margins
- padding
- font metrics
- line wrapping
This stage is commonly called layout.
30. π¨ Paint
Now the browser needs to draw things.
It determines:
Text
Backgrounds
Borders
Shadows
Images
Gradients
and produces drawing operations for the rendering system.
31. π§© Composite
Modern browsers can use multiple rendering layers.
Those layers can then be composited together to produce the final frame.
Simplified:
Layer 1 β Header
Layer 2 β Content
Layer 3 β Image
Layer 4 β Animation
β
Composite
β
π₯οΈ Frame
And finally...
π You See The Website
Keyboard
β
URL
β
Browser
β
DNS
β
IP
β
TCP / QUIC
β
TLS
β
HTTP
β
Server
β
Database / APIs
β
HTML / CSS / JS
β
DOM / CSSOM
β
Layout
β
Paint
β
Composite
β
π Website
32. π But What About JavaScript?
We're not done.
Modern websites aren't just HTML.
JavaScript can execute after the page starts loading.
For example:
fetch("/api/user")
might trigger:
Browser
β
HTTP request
β
API server
β
Database
β
JSON response
β
JavaScript
β
Update DOM
β
Browser renders again
This is why modern web applications can feel more like applications than documents.
33. πͺ What About Cookies?
Cookies can also be involved.
A server may send:
Set-Cookie: session=abc123
The browser stores the cookie according to its rules.
Later requests may include it:
Cookie: session=abc123
This helps websites maintain things such as:
- sessions
- preferences
- authentication state
- certain tracking mechanisms
34. π What About Login?
Suppose you're already logged into a website.
The browser might send authentication information through a cookie or another mechanism.
Simplified:
Login
β
Server authenticates user
β
Session established
β
Browser stores credential/session state
β
Future requests identify the session
So when you visit:
/dashboard
the server can determine which account the request belongs to.
35. π± What If You're Using Your Phone?
The overall architecture remains similar.
But the network path may be different.
For example:
Phone
β
Wi-Fi
β
Router
β
ISP
β
Internet
β
Server
Or:
Phone
β
Cellular Network
β
Carrier Network
β
Internet
β
Server
36. π What Happens to the Packet?
At the network level, your data is broken into packets and transported across networks.
A simplified view:
Your Computer
β
Router
β
ISP
β
Internet Routers
β
Destination Network
β
Server
The actual route can vary.
You can inspect routing information with:
traceroute example.com
On Windows:
tracert example.com
37. π§ͺ Try It Yourself
Open DevTools.
Chrome / Edge
Right Click
β
Inspect
β
Network
Then visit a website.
You'll see requests such as:
Document
CSS
JS
Images
Fonts
XHR / Fetch
38. π Inspect a Request
Click a request in the Network tab.
You'll usually find information such as:
Headers
Request URL
Request Method
Status Code
Remote Address
Content-Type
Response
The data returned by the server.
Timing
You can often see timing phases related to:
Queueing
DNS
Connection
TLS
Request
Waiting
Download
This is one of the best ways to show the concepts in the video instead of only talking about them.
39. π οΈ Useful Commands
DNS lookup
nslookup example.com
or:
dig example.com
Trace network path
traceroute example.com
Test HTTP headers
curl -I https://example.com
Make an HTTP request
curl https://example.com
Verbose HTTPS connection
curl -v https://example.com
The verbose output can expose useful connection details such as DNS resolution, connection establishment, TLS negotiation, and HTTP exchange.
40. β‘ Where Does Latency Come From?
The browser isn't necessarily spending all its time downloading data.
A simplified timeline:
DNS
β
βββ DNS lookup
β
βΌ
Connection
β
βββ TCP / QUIC
β
βΌ
TLS
β
βββ Secure handshake
β
βΌ
Request
β
βββ HTTP request
β
βΌ
TTFB
β
βββ Server processing
β
βΌ
Download
β
βββ HTML / CSS / JS
β
βΌ
Rendering
β
βββ Parse
βββ Layout
βββ Paint
βββ Composite
41. ποΈ Why Websites Use Caching
Without caching:
Every request
β
Server
β
Generate response
With caching:
Request
β
Cache
β
Found?
βββ΄ββ
Yes No
β β
Return Server
Caching can happen at multiple layers:
Browser Cache
β
CDN Cache
β
Reverse Proxy Cache
β
Application Cache
β
Database
42. π HTTP/2 and HTTP/3
The web has evolved.
HTTP/1.1
Traditionally represents requests as individual HTTP messages over a TCP connection.
HTTP/2
Introduces features such as:
- multiplexed streams
- binary framing
- header compression
Multiple HTTP streams can share a connection.
TCP Connection
β
ββββββββββββΌβββββββββββ
β β β
HTML CSS JS
Stream 1 Stream 2 Stream 3
HTTP/3
HTTP/3 uses:
HTTP/3
β
QUIC
β
UDP
β
IP
QUIC integrates transport and TLS functionality into its protocol design and provides features such as stream multiplexing and connection migration.
So the simplified modern stack can look like:
HTTP/3
β
QUIC
β
UDP
β
IP
instead of:
HTTP/2
β
TLS
β
TCP
β
IP
43. π§ The Entire Journey
Let's put everything together.
flowchart TD
A["β¨οΈ Type URL"] --> B["Browser parses URL"]
B --> C["Cache checks"]
C --> D["DNS resolution"]
D --> E["IP address"]
E --> F["TCP or QUIC connection"]
F --> G["TLS / HTTPS"]
G --> H["HTTP request"]
H --> I["CDN / Load Balancer"]
I --> J["Web Server"]
J --> K["Application"]
K --> L["Database / APIs"]
L --> M["HTTP Response"]
M --> N["HTML"]
N --> O["DOM"]
N --> P["CSS"]
P --> Q["CSSOM"]
O --> R["Render Tree"]
Q --> R
R --> S["Layout"]
S --> T["Paint"]
T --> U["Composite"]
U --> V["π₯οΈ Pixels on Screen"]
44. π― The 10-Second Explanation
If someone asks you:
βWhat happens when I type a URL?β
You can answer:
The browser parses the URL, resolves the domain through DNS, establishes a network connection, negotiates HTTPS when applicable, sends an HTTP request to the server, receives the response, downloads additional resources like CSS and JavaScript, builds the DOM and rendering structures, calculates layout, paints the page, and finally displays the result on your screen.
45. π§© The Mental Model
Remember these layers:
π WEBPAGE
β²
β
Rendering
β²
β
HTML / CSS / JS
β²
β
HTTP
β²
β
TLS / HTTPS
β²
β
TCP / QUIC / UDP
β²
β
IP
β²
β
DNS
β²
β
URL
Or even simpler:
URL
β
WHERE?
β
DNS
HOW DO I CONNECT?
β
TCP / QUIC
HOW DO I SECURE IT?
β
TLS
WHAT DO I WANT?
β
HTTP
WHERE DOES IT GO?
β
CDN / Server / Application
WHAT DID I GET?
β
HTML / CSS / JS
HOW DO I SHOW IT?
β
DOM β Layout β Paint β Composite
π¨ SCREEN
π§ͺ Mini Experiment
Open your browser and try this:
1. Open DevTools
F12 / Right Click β Inspect
2. Open Network
Network β Reload
3. Click the first document request
Look for:
Request URL
Status Code
Remote Address
Response Headers
Timing
4. Run DNS
dig example.com
5. Inspect HTTP
curl -I https://example.com
6. Trace the route
traceroute example.com
Now you're no longer just learning the theory.
You're watching the process happen.
π¬ Suggested Video Flow
For teaching this on YouTube, don't present it like a textbook.
Use the browser as the protagonist.
Start with:
https://example.com
Then say:
βI'm going to press Enter. Your browser is about to do way more work than you think.β
Then reveal the journey one step at a time:
YOU
β
URL
β
DNS
β
IP
β
TCP / QUIC
β
TLS
β
HTTP
β
SERVER
β
HTML
β
CSS + JS
β
RENDERING
β
SCREEN
At each stage, show the relevant DevTools panel or a simple animation.
π Final Takeaway
The next time you type:
https://youtube.com
don't think:
βA website opened.β
Think:
I entered a URL
β
The browser interpreted it
β
DNS found the destination
β
A network path was established
β
HTTPS secured the communication
β
HTTP requested the resource
β
Servers processed my request
β
HTML/CSS/JS came back
β
The browser parsed everything
β
Layout was calculated
β
Pixels were painted
β
π¨ I see a webpage
That tiny moment between pressing Enter and seeing a webpage is an entire distributed-system story happening in milliseconds.
π Concepts Covered
Networking
DNS Β· IP Β· TCP Β· UDP Β· QUIC Β· Routing Β· Packets
Security
HTTPS Β· TLS Β· Certificates Β· Encryption Β· Certificate Authorities
Web
HTTP Β· Headers Β· Cookies Β· Status Codes Β· CDN Β· Load Balancers Β· APIs
Backend
Servers Β· Application Logic Β· Databases Β· Caching
Browser
HTML Β· DOM Β· CSSOM Β· Render Tree Β· Layout Β· Paint Β· Composite Β· JavaScript
π One Last Question
The next time a website takes 5 seconds to load, ask:
Where exactly did those 5 seconds go?
Maybe it was DNS.
Maybe the network.
Maybe TLS.
Maybe the server.
Maybe the database.
Maybe JavaScript.
Maybe rendering.
And that's exactly what browser DevTools lets you investigate. π

Top comments (0)