DNS Record Types Explained: NS, A, AAAA, CNAME, MX, and TXT
July 24, 20266 min read
Web DevelopmentNetworkingDnsComputer Science
How does a browser know where a website lives?
You type example.com into your browser. A moment later, a website appears — but example.com isn't an address a computer can actually use to find anything. Computers navigate the internet using numeric addresses (IPs), not friendly names. So somewhere between you typing that name and a page loading, something had to translate it.
That something is DNS — and the specific instructions it looks up are called DNS records. This guide walks through what DNS is, and each major record type, one at a time, using simple, real-life comparisons instead of technical jargon.
What DNS Is (In Very Simple Terms)
DNS (Domain Name System) is often called the phonebook of the internet — and that’s a genuinely useful way to think about it. Just like an old phonebook let you look up a person’s name and find their phone number, DNS lets a computer look up a domain name (example.com) and find the actual numeric address (an IP address) it needs to connect to.
Without DNS, you’d have to remember and type a string of numbers every time you wanted to visit a website — DNS is simply the layer that lets us use memorable names instead.
Why DNS Records Are Needed
A phonebook entry for one business might list several different pieces of information — its street address, its phone number, maybe a separate fax line. A domain name works the same way: it needs to store several different kinds of information, not just one.
DNS records are exactly that — small, labeled entries that each answer one specific question about a domain: where’s its website, where should its email go, who’s officially in charge of it, and so on. A single domain typically has several different records, each serving its own purpose, working together.
What an NS Record Is (Who’s Responsible for a Domain)
An NS (Name Server) Record answers a very specific question: “who is the official office in charge of this domain’s information?”
Think of it like the head office of a company — before you can ask any specific question about a domain (where’s its website, where’s its email), you first need to know which “office” (which set of name servers) holds the authoritative answers for that domain.
When you set up a domain with a registrar and point it to a DNS provider, you’re essentially telling the internet: “go ask this office for anything about my domain.”
What an A Record Is (Domain → IPv4 Address)
An A Record is the most fundamental record type — it maps a domain name directly to an IPv4 address, the numeric address format that’s been the internet’s backbone for decades.
Think of an A record like a house’s street address. example.com might have an A record saying: "this name lives at 192.0.2.1" — so when someone visits example.com, their browser knows exactly which physical server to knock on the door of.
example.com → A Record → 192.0.2.1
What an AAAA Record Is (Domain → IPv6 Address)
An AAAA Record does exactly the same job as an A record — mapping a domain name to an address — but for IPv6, the newer, much larger address format created because the internet was running out of the older IPv4 addresses.
Using the house analogy: think of AAAA as the same house, just listed under a newer, longer address format that the postal service adopted as the neighborhood grew — the destination is the same; only the address format is different.
example.com → AAAA Record → 2001:0db8:85a3::8a2e:0370:7334
Most modern websites keep both an A and an AAAA record, so visitors can reach the site whether their own connection uses the older or newer addressing format.
What a CNAME Record Is (One Name Pointing to Another Name)
A CNAME (Canonical Name) Record doesn’t point to an address at all — it points to another domain name, essentially saying: “don’t look here, go ask that name instead.”
Think of it like a forwarding note at an old address: “I moved — here’s my new name, go look that one up instead.” A common real-world example: www.example.com might be a CNAME pointing to example.com, so both addresses ultimately lead to the same place without needing their own separate IP address.
www.example.com → CNAME Record → example.com → A Record → 192.0.2.1
Clearing up a common confusion: A vs CNAME
An A record points directly to an IP address. A CNAME record points to another domain name, which then itself resolves to an IP address (often via its own A record). A simple rule of thumb: if you’re pointing to a specific address, use A (or AAAA); if you’re pointing to another name and want it to always follow wherever that name currently leads, use CNAME.
What an MX Record Is (How Emails Find Your Mail Server)
An MX (Mail Exchange) Record tells the internet where email sent to your domain should actually be delivered — a completely separate question from “where’s the website.”
Think of an MX record like the post office responsible for a neighborhood: even though a house has its own street address (its A record), incoming mail is actually routed through the post office that handles that area first. Email for you@example.com doesn't go straight to the same server hosting the website — it goes wherever the MX record says the mail should be handled.
Clearing up a common confusion: NS vs MX
An NS record says who’s in charge of all of a domain’s DNS information in general — the head office. An MX record answers one specific question within that information: where should email go. NS is about overall authority; MX is about one particular kind of delivery, the same way a company’s head office is different from its specific mailroom.
What a TXT Record Is (Extra Information and Verification)
A TXT (Text) Record holds arbitrary text information attached to a domain — not an address, and not a routing instruction, just extra notes attached to the entry.
The most common real-world use: proving you actually own a domain. A service (like an email provider or a hosting platform) might ask you to add a specific TXT record containing a unique code — proving that you have the ability to edit that domain’s DNS settings, and are therefore its legitimate owner. Think of it like adding a small, official note to your listing that says: “yes, I really am who I say I am here.”
TXT records are also commonly used for email security configurations (like SPF and DKIM), which help confirm that email claiming to be from your domain is genuinely authorized to be sent on your behalf.
How All DNS Records Work Together for One Website
Putting it all together, a single, ordinary website typically relies on several of these records simultaneously, each answering its own specific question:
NS Record — “who’s in charge of example.com's DNS settings?"
A Record — “where’s the website, in IPv4 terms?”
AAAA Record — “where’s the website, in IPv6 terms?”
CNAME Record — “www.example.com should follow whatever example.com points to"
MX Record — “where should email for example.com be delivered?"
TXT Record — “here’s proof I own this domain, and here’s how to verify my emails”
None of these records compete with each other — each one is simply responsible for its own specific piece of the puzzle, and together they let one domain name serve a website, handle its email, and prove its own legitimacy, all at once.
Final Takeaway
DNS earns its “phonebook of the internet” nickname honestly — it’s the layer that turns memorable names into the technical details computers actually need. NS records say who’s in charge. A and AAAA records say where the website lives. CNAME records let one name simply follow another. MX records route email to the right place. And TXT records hold whatever extra notes — often proof of ownership — a domain needs to carry. None of it is especially complicated once you see each record as answering its own plain, specific question about a domain.
Frequently Asked Questions
Do I need every record type for a simple website?
> Not necessarily. A basic website needs at least an NS record (set automatically by most hosting providers) and an A or AAAA record. CNAME, MX, and TXT records become relevant once you need a www alias, email, or domain verification, respectively.
Can a domain have more than one A record?
> Yes — a domain can have multiple A records, often used to point to several servers for load distribution or redundancy, so traffic isn’t dependent on a single server.
What happens if I get my MX record wrong?
> Email sent to your domain may fail to deliver entirely, or attempt to reach a server that isn’t actually set up to receive it — which is why MX records need to be set up carefully and correctly.
Is a TXT record a security risk since it’s publicly visible?
> DNS records are generally public information by design, so avoid putting genuinely sensitive secrets directly in a TXT record. They’re intended for verification codes and configuration values meant to be checked by outside services, not for storing private data.
Originally published by Mr Madhukar
Read the complete article on Medium with full formatting & reader responses.