DNS Record Types
How Does a Browser Know Where a Website Lives? (DNS Explained )

Ever wondered “How does a browser know where a website lives?”
Or how it figures out which server in the world is hosting a website?
To answer that, you need to understand a very important concept — DNS (Domain Name System).
Think of DNS as the phonebook of the internet.
Humans use names like : google.com , github.com , myportfolio.dev these all are domain name which human understand.
But computers don’t understand names — they understand IP addresses.
So DNS acts as a translator.
It converts a human-readable domain name into a machine-readable IP address, and tells the browser exactly where to go next to find the website.
In simple words, DNS works like a guide for the browser:
“This website lives on this server — go here.” And to give the correct directions, DNS uses something called DNS Records. In this blog, you will clearly understand:
What DNS is
Why DNS records are needed
How the browser finds the correct server
Different DNS record types:
A Record
AAAA Record
CNAME Record
MX Record
TXT Record
By the end, you’ll know how a single domain actually works behind the scenes when a user opens a website.
1. What DNS is
When you type: google.com into your browser…
How does your computer magically know which server in the world to connect to?
Your laptop doesn’t understand English words.
Servers don’t live at names — they live at IP addresses like: 142.250.183.206
So who translates the name → address?
DNS does.
DNS — The Phonebook of the Internet
Think about real life.You want to visit your friend: You know their name ,But the delivery person needs
their house address So you check contacts: Ravina → XYZ1 MG Road, Bangalore
DNS works the same way.
| Human Friendly | Machine Friendly |
| google.com | 142.250.183.206 |
| github.com | 20.207.73.82 |
The browser asks: “Where does this website live?”
DNS replies: “Here is the address. Go there.”
but there is a DNS resolver who handle all the work whom to ask next..? and where to go next ..?than send that ip to browser
2.Why DNS Records Exist
A website is not just a webpage anymore.
A single domain can have:
Website server
Email server
Subdomains
Verification for Google
Security authentication
So DNS needs different types of entries
Each entry answers a different question.
| Question | DNS Record Answers |
| Where is the website? | A / AAAA (Actual Ip of website) |
| Who manages this domain? | NS(Name Server ) |
| Where to send emails? | MX(Mail Extention) |
| Is this domain verified? | TXT |
| Is this name an alias? | CNAME |
These entries are called DNS Records
1) NS Record — Who Is Responsible for This Domain?
Imagine buying Property . Before knowing the address, the government registry tells you :
These officers manage this property” NS record works exactly like that.
It tells the internet: Which DNS provider controls this domain
Example:
example.com NS ns1.cloudflare.com NS ns2.cloudflare.com
Meaning:
Cloudflare stores all records for this domain
Without NS → The internet doesn’t even know where to ask questions
2) A Record — Domain → IPv4 Address
This is the main record. It answers: Where is the website server?
Example:example.com → 192.168.1.10
Restaurant Name → Street Address
Your browser connects to that IP address and loads the website.
That IP belongs to a server, and the DNS provider (defined by the NS records) is responsible for telling the browser where that server is , No A record = website doesn’t open .
3) AAAA Record — Domain → IPv6 Address
Same job as A record
But for modern internet addresses.
| Type | Example |
| IPv4 | 192.168.1.10 |
| IPv6 | 2400:cb00:2048:1::c629:d7a2 |
Why needed?
Because IPv4 addresses are running out.
IPv6 is the future. Browser prefers AAAA if available, else A.
4) CNAME Record — One Name Points to Another Name
Sometimes you don’t want multiple separate addresses for the same service.
Instead, you want one domain name to automatically point to another domain — so users can access the service using either name.Also, the server’s IP address may change over time.
Rather than updating the IP everywhere manually, the DNS system should automatically resolve the new IP whenever the authoritative name server updates it.
This ensures the domain always connects to the correct server without breaking access
Example: www.example.com → example.com
Instead of giving an IP again, we say:
“Just go wherever example.com goes”
Like: Nickname → Real
Contact Mom → Mom Sharma
Common Confusion — A vs CNAME
| A Record | CNAME |
| Points to IP | Points to another domain |
| Final destination | Just a redirect pointer |
5) MX Record — How Email Finds You
When someone sends: hello@example.com
Email servers ask DNS: “Which post office handles this domain?”
MX record answers: example.com → mail.google.com
Now Google Mail receives it.
No MX = emails bounce
Common Confusion — NS vs MX
| NS | MX |
| Who manages DNS | Who receives email |
6) TXT Record — Verification & Extra Information
TXT record stores notes.
Not for humans.
For services.
Used for:
Google Search Console verification
SSL certificates
SPF / DKIM email security
Example:google-site-verification=dkfjhsd876fsd
Think of it as: A proof document stored at your address
How All Records Work Together (Real Website Example)
Let’s understand everything using a simple startup website: myportfolio.dev
→ A single domain needs multiple DNS records to fully function — not just to open the website, bualso for email and verification.
Step 1 — Domain Ownership (NS Record)
NS → Cloudflare name servers
This tells the internet:
Cloudflare is responsible for storing and providing all DNS information for this domain.
Now whenever a browser wants information about myportfolio.dev, it knows which DNS provider to ask.
Step 2 — Website Hosting (A & AAAA Records)
A → 76.76.21.21
AAAA → 2606:4700:3034::6815:2d
These records tell the browser:
This is the actual server where the website lives.
A record gives the IPv4 address
AAAA record gives the IPv6 address
Now the browser can connect to the server and load the website.
Step 3 — Subdomain Setup (CNAME Record)
www → CNAME → myportfolio.dev
Instead of giving another IP address, we simply say:
www.myportfolio.dev is just another name for myportfolio.dev
So both open the same site:
myportfolio.dev
www.myportfolio.dev
Step 4 — Email Setup (MX Record)
MX → aspmx.l.google.com
This tells mail servers:
All emails for this domain should go to Google’s mail servers.
Now emails like hello@myportfolio.dev will be received correctly.
Step 5 — Verification & Security (TXT Records)
TXT → Google verification code
TXT → SPF email authentication
These records prove domain ownership and improve security.
They are used for:
Google Search Console verification, Preventing email spoofing (SPF) ,Service authentication.
Final Result
With all records working together:
The browser finds the website, Users can access both root and www domain, Emails are delivered properly, Services verify ownership, The domain stays secure
A website works not because of one record —
but because all DNS records cooperate together behind the scenes.
What Happens When You Open a Website (Full Flow)
You see the webpage. All in milliseconds.
Conclusion
Next time you type a website name in your browser, remember — you’re not just accessing a server, you’re interacting with a distributed system that intelligently tracks location changes in real time.
That invisible layer is what keeps the internet stable and user-friendly.
Thank you for reading till the end!
If this helped you learn something new, feel free to share it with others who are exploring networking concepts





