DNS Record Types Explained

By Parth Kumbhar
DNS Record Types Explained: The Internet's Address Book
What is DNS?
Ever wondered how a browser knows exactly where a certain site is located?
Just type hashnode.com into the address bar and press Enter, and in the blink of an eye, a webpage will be displayed. It is like magic, but it is actually a very efficient system that is in place.
That system is DNS (Domain Name System).
If you are a website creator, custom email setup, or domain verifications for other third-party apps, at some point, people will encounter DNS Records. It may look intimidating at first, as it appears to comprise a number of cryptic labels such as A, CNAME, MX, etc.
What we plan to do inside that guide is talk about DNS without all the hard-to-understand jargon. We will let you know exactly what DNS records are, why you need them, and how they all work together.
Browser → DNS → Server Flow:

What is DNS?
(The Phonebook Analogy) The easiest way to grasp what the DNS is would be to liken it to a phonebook.
Computers do not talk in terms of languages such as English or Spanish but rather in numbers. Every connected device, such as the computer containing this website, has an IP address, e.g., 172.67.133.145.
As humans, we are very bad at remembering long strings of random numbers. However, we are good at remembering names such as google.com or mylocaldentist.com.
DNS fills this mould.
So if you are typing a domain name in your browser, what is happening is that your computer is going behind the scenes to say, "Hey, what is the IP address of that name?" And it just figures it out, allows your browser to connect to that particular server.

Why Do We Need Different "Records"?
If DNS is just a phonebook, why isn't it just a simple list of Names mapped to Numbers?
The reason is that domains are used for more than just hosting sites.
Let's look at a real-world example of a business directory. A company's entry could include:
A main street address for customers (The Website).
A separate mailing address for the post office (Email).
A particular person responsible for handling the property (Name Servers).
A note attached to the door indicating the hours of business (Text Records).
DNS records are basically the different kinds of records contained in the directory. They help the internet know what server is doing which task for your domain.
1. The NS Record (The Landlord)
NS stands for Name Server.
Before we can look up an address, we need to know which phonebook to look in.
When you buy a domain name (from GoDaddy, Namecheap, etc.), you have to delegate responsibility for that domain to a DNS provider. The NS records tell the rest of the internet: "If you want answers about mydomain.com, go ask these specific servers."
They are like the landlord or property manager. They hold the keys. If you don't set your NS records correctly, none of the other records matter because nobody will know where to find them.
What it looks like: You usually have at least two NS records for redundancy.
# Zone file example
xyzcorp.com. IN NS ns1.digitalocean.com.
xyzcorp.com. IN NS ns2.digitalocean.com.

2. The A Record (The Street Address)
A is the abbreviation for Address. This is the fundamental record type.
The 'A' record solves the basic problem facing the net: making a hostname point to an IPv4 address. This is the basic link between the human-readable hostname and the computer-readable IP number.
If you wish to load the website on your server to the domain name myapp.com, you will have to point the domain name to the IP of your server by creating an 'A' record for the domain name.

# Pointing the root domain to an IP
example.com. IN A 93.184.216.34
# Pointing a subdomain to a different IP
blog.example.com. IN A 104.16.12.55
3. The AAAA Record (The Newer Street Address)
AAAA stands for Address (four times).
The internet is running out of standard IPv4 addresses (the ones that look like 192.168.1.1). The solution is IPv6, which uses much longer, more complex addresses made of numbers and letters.
An AAAA record works exactly like an A record, but it points a domain name to an IPv6 address.
What it looks like: You can see why we need DNS—nobody is remembering this address!

example.com. IN AAAA 2606:2800:220:1:248:1893:25c8:1946
4. The CNAME Record (The Alias)
CNAME - Canonical Name. Just think of it like a nickname, or "Forwarding Address" sticker.
Sometimes you don't want to point a domain to an IP address, but another domain name.
One of the most common use cases is the www subdomain. Normally you'll want www.example.com to point to exactly the same place as example.com.
Instead of making another 'A' record, which involves editing two records if your server's IP ever changes, you create a CNAME. You're essentially saying: "Hey, if anybody asks for www.example.com, just send them wherever example.com is currently going."
Beginner Confusion Alert: A vs. CNAME
A Record: Maps a name to a number (IP).
CNAME: Maps a name to another name

# If you change the IP for example.com, the www automatically follows.
www.example.com. IN CNAME example.com.
5. The MX Record (The Mailroom)
MX stands for Mail Exchange.
This is crucial. Your website and your email rarely live on the same server.
When someone sends an email to contact@yourdomain.com, the sending email server (like Gmail) needs to know where to deliver that message. It doesn't care about your 'A' record (your website). It looks specifically for MX records.
The MX record tells the internet: "Please deliver all emails destined for this domain to these specific mail servers."
What it looks like: MX records have a "Priority" number. Lower numbers mean higher priority. If the primary server (priority 10) is down, senders will try the secondary one (priority 20).
# Pointing email to Google Workspace servers
yourdomain.com. IN MX 10 aspmx.l.google.com.
yourdomain.com. IN MX 20 alt1.aspmx.l.google.com.

6. The TXT Record (The Sticky Note) TXT stands for Text.
Unlike other records that serve to control traffic, the TXT record offers data about the domain in plain text form.
Think of it like a sticky note on the door for certain visitors.
The most common uses are:
Verification: When you register for services such as Google Analytics or Facebook Business Manager, you are asked to set a particular TXT record. They verify the presence of this record to ensure you are the actual owner of the domain.
Email Security: SPF, DKIM: Some special TXT entries are made that inform the email server receiving your email, such as Gmail or Outlook, which IPs are authorized to send emails on your behalf, so that your emails are not mistaken as spams.
# A Google verification stickynote
example.com. IN TXT "google-site-verification=StringOfRandomLettersAndNumbers"
# An SPF record for email security
example.com. IN TXT "v=spf1 include:_spf.google.com ~all"

Putting It All Together
It’s rarely about using just one record. A typical setup for a small business website uses dozens of them working in harmony.
Let's imagine a fictional startup, PixelRocket.io. Here is what their DNS setup might look like to make everything work:
| Record Type | Host / Name | Value / Target | What it does |
| NS | @ (root) | ns1.cloudflare.com | Tells the world Cloudflare manages these records. |
| A | @ | 104.21.55.11 | Points pixelrocket.io to the web server IP. |
| CNAME | www | pixelrocket.io | Ensures www.pixelrocket.io goes to the same place. |
| CNAME | blog | hashnode.network | Points their blog subdomain to Hashnode's platform. |
| MX | @ | aspmx.l.google.com (Priority 10) | Routes incoming emails to Gmail. |
| TXT | @ | v=spf1 include:_spf.google.com ~all | Helps prevent their sent emails from being marked as spam. |
Summary !!
DNS may sound confusing just from the acronyms, but it really isn't that difficult. Basically, it is just a series of integration techniques to access a specific domain.
NS: Who manages the records? (The Landlord)
A / AAAA: Where is the website server? (The Street Address)
CNAME: Does this have a special name? (The Alias)
MX: Where does the email go? (The Mailroom)
TXT: Is there extra info or verification needed? (The Sticky Note)
Learning the basics of these concepts eliminates the fear factor when it comes to clicking on the "Save" button in your DNS configuration panel.
Blog Footer
✍️ Written By, Parth Kumbhar
💻 Web Developer | CS Btech Student
🌱 Learning, building, and sharing tech every day
🔗 Connect with me
Linkedin → Click me