DNS Record Types Explained: A Beginner's Guide
Ever wondered how your browser knows where to find a website when you type in a name like google.com? You don't type in a bunch of numbers, yet somehow your browser finds exactly the right server among billions of devices on the internet.
The answer lies in something called DNS — and understanding it will demystify how the internet actually works.
What is DNS?
Imagine you want to call your friend. You don't memorize their phone number — you just look up their name in your phone's contacts, and it finds the number for you.
DNS (Domain Name System) works exactly like that for the internet.
Every website lives on a computer (called a server) somewhere in the world. That server has a unique address made of numbers, like 142.250.190.78. But humans are terrible at remembering numbers like that. We're much better with names like google.com.
DNS is the system that translates human-friendly names into computer-friendly numbers.
┌─────────────────────────────────────────────────────────────┐
│ DNS: The Internet's Phonebook │
├─────────────────────────────────────────────────────────────┤
│ │
│ You type: DNS looks up: Browser connects: │
│ │
│ google.com ───► DNS Server ───► 142.250.190.78 │
│ │
│ (Name) (Lookup) (Actual Address) │
│ │
└─────────────────────────────────────────────────────────────┘
Why Do We Need DNS Records?
A domain name isn't just about finding one server. A single domain might need to:
Point visitors to a website
Receive emails
Prove ownership to Google or other services
Work with both old and new internet protocols
Each of these needs is handled by a different DNS record. Think of DNS records as different entries in a contact card — one field for the phone number, another for email, another for the home address.
Let's look at each type, one at a time.
NS Record: Who's in Charge?
What it does: Tells the internet which servers are responsible for answering questions about your domain.
Real-life analogy: Imagine you want to know something about a company. Before you can ask any questions, you need to know who to ask. The NS record points you to the right authority.
When you register a domain, you're essentially saying: "For any questions about mywebsite.com, ask these nameservers."
┌────────────────────────────────────────────────────────────┐
│ NS Record Example │
├────────────────────────────────────────────────────────────┤
│ │
│ mywebsite.com NS → ns1.cloudflare.com │
│ mywebsite.com NS → ns2.cloudflare.com │
│ │
│ "For questions about mywebsite.com, │
│ ask Cloudflare's nameservers" │
│ │
└────────────────────────────────────────────────────────────┘
Why it matters: Without NS records, no one would know where to look up any other information about your domain. It's the first step in the whole DNS process.
A Record: The Main Address
What it does: Maps a domain name to an IPv4 address (the traditional number format like 93.184.216.34).
Real-life analogy: This is like the street address on your contact card. When someone wants to visit, this tells them exactly where to go.
The "A" stands for "Address" — simple enough!
┌────────────────────────────────────────────────────────────┐
│ A Record Example │
├────────────────────────────────────────────────────────────┤
│ │
│ example.com A → 93.184.216.34 │
│ │
│ "When someone visits example.com, │
│ send them to server 93.184.216.34" │
│ │
└────────────────────────────────────────────────────────────┘
Why it matters: This is the most fundamental DNS record. Every website needs at least one A record so browsers can find it.
AAAA Record: The Newer Address Format
What it does: Maps a domain name to an IPv6 address (the newer, longer format like 2606:2800:220:1:248:1893:25c8:1946).
Real-life analogy: Think of this as an extended postal code. The old system (IPv4) is running out of addresses — there are only about 4 billion possible IPv4 addresses, and we have way more devices than that now. IPv6 has enough addresses for every grain of sand on Earth.
The "AAAA" is pronounced "quad-A" and literally means "four A records worth of address space."
┌────────────────────────────────────────────────────────────┐
│ AAAA Record Example │
├────────────────────────────────────────────────────────────┤
│ │
│ example.com AAAA → 2606:2800:220:1:248:1893:25c8:1946 │
│ │
│ "For modern devices using IPv6, │
│ this is example.com's address" │
│ │
└────────────────────────────────────────────────────────────┘
Why it matters: As the internet grows, IPv6 is becoming more important. Many websites have both A and AAAA records so they work with both old and new systems.
CNAME Record: An Alias
What it does: Points one domain name to another domain name (not directly to an IP address).
Real-life analogy: Imagine your contact card says "For John's work number, see IBM's main directory." You're not giving the number directly — you're pointing to another place that has the number.
CNAME stands for "Canonical Name" — meaning "the official name."
┌────────────────────────────────────────────────────────────┐
│ CNAME Record Example │
├────────────────────────────────────────────────────────────┤
│ │
│ www.mysite.com CNAME → mysite.com │
│ blog.mysite.com CNAME → myblog.wordpress.com │
│ │
│ "www.mysite.com is just another name for mysite.com" │
│ "blog.mysite.com actually points to WordPress" │
│ │
└────────────────────────────────────────────────────────────┘
Why it matters: CNAME records are incredibly useful for:
Making
www.mysite.comandmysite.comgo to the same placePointing subdomains to external services (like your blog hosted elsewhere)
Simplifying management — if the target's IP changes, you don't have to update anything
A vs CNAME: What's the Difference?
This is a common point of confusion. Here's the simple rule:
| Record | Points to | Example |
| A | An IP address directly | mysite.com → 93.184.216.34 |
| CNAME | Another domain name | www.mysite.com → mysite.com |
Think of it this way: A record is a direct address, CNAME is a redirect to find the address elsewhere.
MX Record: Email Delivery
What it does: Tells email servers where to deliver mail for your domain.
Real-life analogy: This is like the "mail forwarding" address on your contact card. Even if you live at 123 Main Street, you might have your mail delivered to a P.O. Box or a mail processing service instead.
MX stands for "Mail Exchange."
┌────────────────────────────────────────────────────────────┐
│ MX Record Example │
├────────────────────────────────────────────────────────────┤
│ │
│ mycompany.com MX 10 → mail.mycompany.com │
│ mycompany.com MX 20 → backup-mail.mycompany.com │
│ │
│ "Deliver emails for @mycompany.com to mail.mycompany.com│
│ If that fails, try backup-mail.mycompany.com" │
│ │
│ (Lower number = higher priority) │
│ │
└────────────────────────────────────────────────────────────┘
The priority number: MX records have a priority value. Lower numbers mean "try this first." If your primary mail server is down, email goes to the backup server with the next lowest number.
Why it matters: Without MX records, no one could send you email. Even if your website and email are on completely different servers, DNS routes each type of traffic correctly.
NS vs MX: What's the Difference?
Another common confusion:
| Record | Purpose | Analogy |
| NS | Who answers DNS questions | "Ask this person about me" |
| MX | Where to deliver email | "Send my mail here" |
They both point to servers, but for completely different purposes.
TXT Record: Notes and Verification
What it does: Stores arbitrary text information about your domain.
Real-life analogy: This is like the "notes" section on a contact card. You can put anything there — and people have found lots of creative uses for it.
┌────────────────────────────────────────────────────────────┐
│ TXT Record Examples │
├────────────────────────────────────────────────────────────┤
│ │
│ Domain Verification: │
│ mysite.com TXT → "google-site-verification=abc123..." │
│ │
│ Email Security (SPF): │
│ mysite.com TXT → "v=spf1 include:_spf.google.com ~all" │
│ │
│ Human-readable note: │
│ mysite.com TXT → "Contact admin@mysite.com for issues" │
│ │
└────────────────────────────────────────────────────────────┘
Common uses:
Domain verification: Google, Microsoft, and other services ask you to add a specific TXT record to prove you own a domain
Email security (SPF, DKIM, DMARC): These TXT records help prevent email spoofing and spam
General information: Sometimes just human-readable notes
Why it matters: TXT records are the Swiss Army knife of DNS. They've become essential for security and verification across the modern internet.
Putting It All Together
Let's see how a real website might use all these records together. Imagine you're setting up coffeshop.com:
┌─────────────────────────────────────────────────────────────────┐
│ Complete DNS Setup for coffeeshop.com │
├─────────────────────────────────────────────────────────────────┤
│ │
│ NS Records (Who manages this domain) │
│ ───────────────────────────────────── │
│ coffeeshop.com NS ns1.registrar.com │
│ coffeeshop.com NS ns2.registrar.com │
│ │
│ A Records (Website addresses) │
│ ───────────────────────────── │
│ coffeeshop.com A 192.0.2.1 │
│ │
│ AAAA Records (IPv6 addresses) │
│ ───────────────────────────── │
│ coffeeshop.com AAAA 2001:db8::1 │
│ │
│ CNAME Records (Aliases) │
│ ─────────────────────── │
│ www.coffeeshop.com CNAME coffeeshop.com │
│ shop.coffeeshop.com CNAME myshop.shopify.com │
│ │
│ MX Records (Email routing) │
│ ───────────────────────── │
│ coffeeshop.com MX 10 mail.coffeeshop.com │
│ coffeeshop.com MX 20 mail-backup.coffeeshop.com │
│ │
│ TXT Records (Verification & Security) │
│ ───────────────────────────────────── │
│ coffeeshop.com TXT "v=spf1 include:_spf.google.com ~all" │
│ coffeeshop.com TXT "google-site-verification=xyz789..." │
│ │
└─────────────────────────────────────────────────────────────────┘
Here's what happens when someone interacts with this domain:
┌─────────────────────────────────────────────────────────────────┐
│ How DNS Records Work Together │
├─────────────────────────────────────────────────────────────────┤
│ │
│ VISITING THE WEBSITE │
│ ──────────────────── │
│ │
│ User types: www.coffeeshop.com │
│ ↓ │
│ DNS lookup: www.coffeeshop.com → CNAME → coffeeshop.com │
│ ↓ │
│ DNS lookup: coffeeshop.com → A → 192.0.2.1 │
│ ↓ │
│ Browser connects to 192.0.2.1 │
│ │
│ ───────────────────────────────────────────────────────────── │
│ │
│ SENDING AN EMAIL TO orders@coffeeshop.com │
│ ───────────────────────────────────────── │
│ │
│ Email server asks: Where do I deliver mail for coffeeshop.com?│
│ ↓ │
│ DNS lookup: coffeeshop.com → MX → mail.coffeeshop.com (pri 10)│
│ ↓ │
│ Email delivered to mail.coffeeshop.com │
│ │
└─────────────────────────────────────────────────────────────────┘
Quick Reference Cheat Sheet
| Record | Purpose | Points To | Example Use |
| NS | "Who manages this domain" | Nameservers | ns1.cloudflare.com |
| A | "IPv4 address" | IP address | 93.184.216.34 |
| AAAA | "IPv6 address" | IPv6 address | 2606:2800:220:1:... |
| CNAME | "Alias for another name" | Another domain | www → example.com |
| MX | "Where to send email" | Mail servers | mail.example.com |
| TXT | "Extra information" | Text | Verification codes, SPF |
Wrapping Up
DNS might seem complex at first, but it's really just a clever system of lookups:
NS records tell the internet who to ask about your domain
A and AAAA records provide the actual server addresses
CNAME records create convenient aliases
MX records route your email to the right place
TXT records carry verification and security information
Every time you visit a website, send an email, or verify domain ownership, DNS records are working behind the scenes to make it happen. Understanding them gives you insight into how the internet really works — and makes you much more capable of setting up and troubleshooting your own domains.
The next time someone asks how the internet knows where websites live, you'll have the answer: DNS records — the internet's phonebook.
Have questions about DNS? Drop a comment below!