DNS Record Types Explained

To understand what is DNS records we should have the basic knowledge of how a browser(client) access a website. We know that every device connected to the internet gets a unique IP address. And to communicate with that device we need that IP address.
A website is hosted on a server and when we want to access that website we must talk with the server and to communicate with the server we need the IP address of that server but IP addresses are difficult to remember for humans.Imagine trying to remember numbers like 142.250.195.78 for every website you visit—it’s not practical.
So to solve this problems DNS appeared. DNS stands for Domain Name System. DNS acts like a translator.
DNS as a phonebook
DNS is a like a phone book of internet. Just like when we want to call someone we don’t remember their phone number. Instead, we search for their name in the phone’s contact list and it gives us the phone number of that person. DNS works in the same way.
On the internet, we don’t remember IP addresses of websites. Instead, we type an easy-to-remember domain name like example.com. DNS looks up this domain name and gives us the IP address of the server where the website is hosted.

Why DNS Records Are Needed
DNS does more than just convert a domain name into an IP address. A single domain needs information for different purposes, such as showing a website, handling emails, and verifying ownership. To manage this, DNS stores information in small pieces called DNS records. Each record has a specific job and answers a specific question about the domain. So let's look at each records at a time:
NS Record
NS Record stores the domain names of authoritative dns server responsible for our domain.
When we buy a domain from a domain registrar, we provide the details of our name servers. The registrar then shares this information with the TLD server (such as .com, .org, etc.).
So, when a user requests a website, the TLD server responds with the name servers that are responsible for that domain. The browser (through the DNS resolver) then contacts those name servers to get the required domain information.
Note: At every level of the DNS hierarchy, NS (Name Server) records tell the resolver where to go next: 1.Root level NS: Points to the TLD servers (e.g., .com, .net). 2.TLD level NS: Points to the authoritative servers for domains under that TLD (e.g., ns1.google.com). 3.Authoritative NS: The actual server that stores the DNS records (A, AAAA, CNAME) for the domain. The resolver follows this chain of NS records until it reaches the authoritative server that can return the real IP. This is why NS records exist at every level of DNS.A Record
A Record stands for Address record. A Record stores the ip address of server where the website is hosted on and mapped the domain name with that ip address.
When the DNS resolver reaches the authoritative DNS server for a domain, it requests the A record for that domain. The authoritative server responds with the A record, which contains the IP address of the server hosting the website. The resolver then uses this IP to connect the browser to the server and load the website.
AAAA Record
The AAAA record works the same way as an A record, but instead of storing an IPv4 address, it stores an IPv6 address. It exists because the internet is running out of IPv4 addresses, and IPv6 provides a much larger address space. Just like an A record, the AAAA record maps a domain name to the server’s IP address, allowing browsers that use IPv6 to reach the website.
CNAME Record
A CNAME record (Canonical Name record) does not store an IP address. Instead, it points to another domain name where the application or website is hosted. Nowadays, authoritative DNS servers often return CNAME records because they make DNS management much easier.
You might wonder why CNAME is important. Imagine a server hosting an application — normally, an A record stores the server’s IP address. But if the server’s IP changes, the domain owner would have to update the DNS tables everywhere, which could be complicated if multiple DNS providers are involved. Instead, by using a CNAME record pointing to the server’s domain name, the actual IP can change without affecting the domain, because the alias always points to the correct server domain.
MX Record
Every domain can send or receive emails, and to manage this we need mail servers. Instead of storing the server’s IP directly, the MX record stores the mail server’s domain name, similar to how a CNAME points to another domain.
Note: MX records are used only for receiving emails, not for sending them.
TXT Record
A TXT record (Text record) allows domain owners to store any extra information in DNS as plain text. It is commonly used for verification, security, and configuration, such as proving domain ownership or setting up email authentication (SPF, DKIM). Unlike A, MX, or CNAME records, a TXT record doesn’t direct traffic — it simply provides information that other systems can check.
For example, a TXT record might contain a string like:
v=spf1 include:_spf.google.com ~
all This tells email servers which servers are allowed to send emails on behalf of the domain.
Example: DNS Records for mysite.com (Hosted on a modern provider)
Assume:
Website hosted on a cloud provider
Uses
www.mysite.comEmail handled by Google Workspace
Uses CNAME-based hosting (common today)
DNS Records Table
| Type | Name (Host) | Value / Target | TTL | Purpose |
| NS | mysite.com | ns1.dnsprovider.com | Auto | Authoritative name server |
| NS | mysite.com | ns2.dnsprovider.com | Auto | Authoritative name server |
| A | mysite.com | 203.0.113.10 | Auto | Points root domain to server IP |
| CNAME | www | mysite.com | Auto | www.mysite.com → mysite.com |
| CNAME | app | app.hostingprovider.com | Auto | App hosted via provider domain |
| MX | mysite.com | aspmx.l.google.com (priority 1) | Auto | Google mail server |
| MX | mysite.com | alt1.aspmx.l.google.com (priority 5) | Auto | Backup mail server |
| TXT | mysite.com | v=spf1 include:_spf.google.com ~all | Auto | SPF email authentication |
| TXT | _google-site-verification | abc123xyz | Auto | Domain ownership verification |
Summary
DNS records are the building blocks that help the internet understand how a domain should work. When a user enters a domain name in the browser, DNS uses these records to find the authoritative name servers, locate the correct IP address of the website, route emails to the right mail servers, and verify domain ownership and security settings. Records like NS decide who manages the domain, A/AAAA connect domains to servers, CNAME provides flexible aliases, MX handles email delivery, and TXT supports verification and security. Together, these DNS records ensure that websites load correctly, emails are delivered properly, and domains remain manageable and secure.
Thank you for reading & Happy Coding 👨💻
References: ChaiCode Web Development Cohort 2026, Cloudflare DNS Learning




