Understanding DNS Record Types.

How does a browser know where the website lives?
When you type
google.comthe browser don’t know where is this website is.Computers can’t understand website names, they only understand IP addresses like
142.250.190.14.So when you type domain name
goole.com, browser needs an IP address to find that IP address DNS helps.
What is DNS
DNS(Domain Name System) is a distributed system that maps human-readable domain names into IP addresss , it acts like internet phonebook .
Humans like to use names because they are easy to remember and Computer like to use numbers because they understand numbers, DNS connects these two.
Why DNS records are needed
DNS by itself is just a system, to actually work, it needs information, that information is stores using DNS records.
A single website needs different kinds of information like where is the website lives, who controls the domain, where email should go, extra verification data.
One type of record can’t store all this.
So DNS uses different record types, each with a specific job.
What is NS record
NS(Name server) record tells the internet which DNS authoritative servers are responsible for a domain.
An NS record tells which authoritative DNS servers manage a domain.
When you search
google.com→ DNS resolver reaches TLD server.com→ TLD server checks the NS records → NS record tells where the authoritative DNS server is → Authoritative server returns the IP address.Example:
1.A user searches
google.com2.The DNS resolver reaches the
.comTLD server
3.The.comTLD server returns the NS recordsns1.google.com,ns2.google.com,ns3.google.com, andns4.google.com.
4.The DNS resolver contacts one of the listed NS(Name servers).
5.That server returns the IP address142.251.220.46.
What is an A record
The A record is stored on the authoritative DNS server, where all DNS records for a domain are kept.
An A record stores the IPv4 address of website.
The DNS resolver gets this record from the authoritative DNS server during DNS resolution.
Example: A record for
google.com→142.250.190.14.
What is an AAAA record
An AAAA (Quad-A) record is stored on the authoritative DNS server, along with the other DNS records for a domain.
An AAAA record stores the IPv6 address of website.
IPv6 addresses are newer and longer that IPv4 addresses, and IPv6 are used to support the growing number of internet devices.
During DNS resolution, if a system supports IPv6, the DNS resolver can retrieve the AAAA record to find the website’s IPv6 address.
Example: AAAA record for
google.com→2607:f8b0:4005:080a::200e.A website can have the both A record(IPv4) and AAAA record(IPv6) at the same time.
Browsers give higher prority to AAAA record (IPv6).
Browser first asks DNS for AAAA record (IPv6), if IPv6 ia available browser use it, if not browser falls back to A record(IPv4).
What is CNAME record
A CNAME (Canonical Name) record is stored on the authoritative DNS server, along with other DNS records for a domain.
CNAME record don’t store a IP address.
It points one domain name to another domain name.
Sometimes, the same website should be accessible using multiple domain names like
google.com,www.google.com.Instead of storing the IP address multiple times, DNS uses a CNAME record to avoid duplication.
How a CNAME record works
A user types
www.google.comDNS finds a CNAME record
The CNAME points to
google.comDNS then looks up the A or AAAA record of
google.comThe IP address returned
What is MX record
An MX (Mail Exchange) record is stored on the authoritative DNS server, along with other DNS records for a domain.
MX record tells the internet which mail server should receive emails for a domain.
Example: how mx record works
Let says your domain name is
xyz.comYour MX record is
xyz.comMX10mail.xyz.comAll emails sent to
@xyz.com, such asadmin@xyz.com,hr@xyz.com.should be delivered to the mail server
mail.xyz.com.The mail server then distributes each email to the correct mailbox.
What is TXT record
A TXT record is a DNS record used to store extra information about domain.
TXT record store text data that is read by machines, not humans.
TXT records likes Domain verification, Email security, Ownership proof.
Uses of TXT records
Domain verifivation: when you connect a service (google, vercel, github, etc) they ask to add a TXT record.
Ex:abc.comTXTgoogle-site-verification=abc123Email security:TXT record are used to prevent email spoofing, Only these servers are allowed to send emails for
abc.com
Ex:abc.comTXTv=spf1include:_spf.google.com~all
How all DNS records work together for one website
NS(Name server) → finds authoritative DNS server.
CNAME → Resolve alias (if any).
A / AAAA → Gets IP address.
Browser connects to the server.
MX → finds mail server.
TXT → helps verify and secure email.
How DNS actually works


