DNS & DNS Record Types Explained
When you type shivam-goyal.site into your browser, how does your browser know where that website actually lives?
Your browser needs to find a server somewhere on the internet, and that server has an IP address (like a house has a street address). But humans don’t like remembering long numbers, so we use names instead.
This is where DNS and DNS records come in.
In this article, we’ll cover, in simple language:
- What DNS is
- Whyare DNS records needed
- NS records (who is responsible for a domain)
- A records (name → IPv4 address)
- AAAA records (name → IPv6 address)
- CNAME records (one name pointing to another name)
- MX records (how emails find your mail server)
- TXT records (extra information and verification)
- How all of them work together for one website
What Is DNS? (The Internet’s Phonebook)
The basic question
Your browser has one big question:
\> “Where does this website live?”
For example:
- You type: shivam-goyal.site
- Browser needs: an IP address like 142.250.72.14 (example)
The internet runs on IP addresses, not names. But humans prefer names. So we need a way to translate:
\> Name → IP address
DNS in one sentence
DNS (Domain Name System) is like the phonebook of the internet:
- You look up a name (like shivam-goyal.site)
- DNS tells you the number (the IP address of the server)
Text diagram:
Browser → asks DNS: “Where is shivam-goyal.site ?”
DNS → replies: “It’s at 203.0.113.10.”
Browser → connects to 203.0.113.10 and loads the site
Why DNS Records Are Needed
DNS is not just one big list. It’s more like a database with different types of entries, each answering a different question.
A DNS record is one small piece of information about a domain.
Some examples of questions DNS records answer:
- “Which server shows the website?”
- “Which server receives emails for this domain?”
- “Which name servers are responsible for this domain’s DNS?”
- “Is this domain allowed to send email from this IP?”
- “Is this domain verified with some service (Google, AWS, etc.)?”
Each of these questions has a different record type: A, AAAA, CNAME, MX, NS, TXT, and more.
You can think of it like a contact entry on your phone:
- Name: “Shivam”
- Mobile: 123-456-7890
- Work: 555-555-5555
- Email: shivam@shivam-goyal.ite
- Notes: “Met at conference.”
One person, many pieces of info.
One domain, many DNS records.
NS Record – Who Is Responsible for a Domain?
What is an NS record?
NS stands for Name Server.
An NS record says:
“These name servers are responsible for answering DNS questions about this domain.”
In other words, NS records tell the world where to go to ask about your domain’s DNS.
Real-life analogy
Imagine a city hall has a list that says:
- “For all questions about this house, talk to this lawyer/agent.”
That agent doesn’t live in the house but is responsible for its paperwork.
Similarly:
- NS records don’t store the website’s IP directly
- They point to the DNS provider that holds all the details (A, MX, CNAME, etc.)
Example
For shivam-goyal.site, NS records might say:
- ns1.dns-provider.com
- ns2.dns-provider.com
This means:
“If you want to know anything about shivam-goyal.site, ask ns1.dns-provider.com or ns2.dns-provider.com.”
A Record – Domain → IPv4 Address
What is an A record?
An A record maps a name to an IPv4 address.
IPv4 addresses look like this:
- 203.0.113.10
- 192.0.2.1
An A record says:
shivam-goyal.site lives at 203.0.113.10.”
Real-life analogy
Think of it as:
- Name: “Shivam”
- Address: “123 Main Street”
In DNS:
- Name: shivam-goyal.site
- Address: 203.0.113.10
When your browser asks DNS:
“Where is shivam-goyal.site”
The A record answers:
“At IP 203.0.113.10.”
When A records are used
A records are used for:
- Website addresses (shivam-goyal.site, www.shivam-goyal.site)
- API endpoints (api.shivam-goyal.site)
- Any service reachable over IPv4
If you only remember one record type, it’s often the A record, because it’s what most beginners think of as “the DNS record”.
AAAA Record – Domain → IPv6 Address
What is an AAAA record?
An AAAA record is like an A record, but for IPv6 instead of IPv4.
IPv6 addresses look like this:
- 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Or shortened:
- 2001:db8:85a3::8a2e:370:7334
An AAAA record says:
\> shivam-goyal.site lives at IPv6 address 2001:db8:85a3::8a2e:370:7334.”
Why IPv6?
IPv4 addresses are running out. IPv6 was created so we can have a lot more addresses.
You don’t need to deeply understand IPv6 to understand AAAA records. Just remember:
- A = IPv4
- AAAA = IPv6
Real-life analogy
If you think of IPv4 as an old addressing system with limited house numbers, IPv6 is like a new system with an almost infinite number of house numbers available.
CNAME Record – One Name Pointing to Another Name
What is a CNAME record?
CNAME stands for Canonical Name.
A CNAME record says:
“This name is just an alias. Go ask that other name for the real address.”
For example:
- www.shivam-goyal.site → CNAME → shivam-goyal.site
This means:
“To find www.shivam-goyal.site, just look up shivam-goyal.site instead.”
Real-life analogy
Imagine you save two contacts in your phone:
- “Shivam”
- “Best Friend”
But both point to the same phone number.
Best Friend is just a nickname for Shivam. If someone calls “Best Friend”, your phone actually dials Shivam’s number.
CNAME is the nickname. The “real” record (with the IP) is usually an A or AAAA record.
A vs CNAME
- A record:
Name → IP address directly
(shivam-goyal.site → 203.0.113.10)
- CNAME record:
Name → another name
(blog.shivam-goyal.site → shivam-goyal.hashnode.dev)
Important points:
- A CNAME cannot point directly to an IP. It must point to another name.
- A single name usually shouldn’t have both an A record and a CNAME at the same time. It’s typically one or the other.
MX Record – How Emails Find Your Mail Server
What is an MX record?
MX stands for Mail eXchange.
An MX record says:
“Emails for this domain should go to this mail server.”
For example:
Now when someone sends an email to:
The sending mail server asks DNS:
\> “Where should I deliver email for shivam-goyal.site?”
The MX record answers:
\> “Send it to mail.shivam-goyal.site.”
Behind mail.shivam-goyal.site, there will be an A or AAAA record with the real IP address.
Real-life analogy
Think of:
- Domain = Company name
- MX record = Address of the mailroom of that company
If you send a letter to “Shivam at shivam-goyal.site”, the post office looks up:
“Where is the mailroom for shivam-goyal.site?”
That’s what MX does for email.
NS vs MX (common confusion)
- NS record:
“Who answers DNS questions for this domain?”
(DNS provider / name servers)
- MX record:
“Where should emails for this domain be delivered?”
(Mail server location)
So:
- NS = Who to ask about DNS?
- MX = Where to send the email?
TXT Record – Extra Info and Verification
What is a TXT record?
A TXT record stores text information.
Originally, it was for “any extra text,” but today it’s heavily used for verification and security.
Common uses:
- SPF records: Which servers are allowed to send email for a domain
- DKIM/DMARC: Email authentication and anti-spam
- Domain verification: Proving to a service (like Google, AWS, Stripe, etc.) that you own the domain
Real-life analogy
Think of TXT records as sticky notes attached to your domain:
- “Only these servers can send email for me.”
- “Yes, I verified my domain with Service X.”
- “Here are some extra details about me.”
They don’t directly route web or email traffic, but they help with trust, verification, and security.
How All DNS Records Work Together for One Website
Let’s put everything together for a fictional website: shivam-goyal.site.
Example DNS setup
Imagine this simple setup:
- Website at: shivam-goyal.site
- “www” version: www.shivam-goyal.site
- Email at: hello@shivam-goyal.site
- Using a DNS provider at ns1.dns-provider.com, ns2.dns-provider.com
- Mail server at mail.shivam-goyal.site
Your DNS records might look like this (conceptually):
- NS records for shivam-goyal.site
- ns1.dns-provider.com
- ns2.dns-provider.com
→ “These name servers are responsible for this domain.”
- A record for shivam-goyal.site
- shivam-goyal.site → 203.0.113.10
→ “Main website lives at this IPv4 address.”
- AAAA record for shivam-goyal.site (optional, if you use IPv6)
- shivam-goyal.site → 2001:db8:85a3::8a2e:370:7334
→ “Main website also has this IPv6 address.”
- CNAME record for www.shivam-goyal.site
→ “www is just another name for the main site.”
- A record for mail. shivam-goyal.site
- mail.shivam-goyal.site → 203.0.113.20
→ “Mail server lives at this IP.”
- MX record for shivam-goyal.site
→ “Emails should be sent to the mail server.”
- TXT records for shivam-goyal.site
- SPF: “Only these IPs can send mail for this domain.”
- Verification: “This code proves I own this domain to Service X.”
Flow diagram
Browser loading your website
You type: shivam-goyal.site
Browser → DNS: “What is the IP of shivam-goyal.site?”
DNS:
NS says: “Ask ns1.dns-provider.com”
A record says: “It’s 203.0.113.10”
Browser → connects to 203.0.113.10 → loads website
Browser loading www.shivam-goyal.site
Browser → DNS: “What is the IP of www.shivam-goyal.site?”
DNS:
CNAME: “Go ask shivam-goyal.site instead.”
A record for shivam-goyal.site: “It’s 203.0.113.10”
Browser → connects to 203.0.113.10 → loads website
Someone is sending an email to hello@shivam-goyal.site
Sending mail server → DNS: “Where do I send email for shivam-goyal.site?”
DNS:
MX: “Send to mail.shivam-goyal.site”
A: “mail.shivam-goyal.site is 203.0.113.20”
Sending mail server → connects to 203.0.113.20 → delivers email
Quick Summary of Each Record Type
- NS record
- What it says: “These servers are responsible for DNS of this domain.”
- Analogy: Who holds the official paperwork.
- A record
- What it says: “This name maps to this IPv4 address.”
- Analogy: House address.
- AAAA record
- What it says: “This name maps to this IPv6 address.”
- Analogy: Newer, bigger house numbering system.
- CNAME record
- What it says: “This name is just another name for that name.”
- Analogy: Nickname pointing to a real name.
- MX record
- What it says: “Send email for this domain to this mail server.”
- Analogy: Mailroom address.
- TXT record
- What it says: “Here’s some extra text info (verification, email rules, etc.).”
- Analogy: Sticky notes/extra notes on the file.
Final Thoughts
DNS might look scary at first, but at its core, it’s just:
- A phonebook that turns names into IP addresses
- A set of records, each solving one small problem
If you remember:
- A / AAAA → where the website lives (IP)
- CNAME → nickname for another name
- MX → where emails go
- NS → who answers DNS for this domain
- TXT → extra info and verification
…you already understand more DNS than many beginners.
From here, you can:
- Open your domain’s DNS settings and try to identify each record type
- Add a simple CNAME for www pointing to your root domain
- Read about how DNS and HTTP work together when you visit a website
Step by step, it becomes much less magical and more like a system you can actualy reason about and control.
Happy Learning! 🚀
Have questions about how browsers work? Drop them in the comments!




