Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
6 min read
DNS Record Types Explained

A Beginner's Journey Into How the Internet Finds Websites

Ever wondered what happens in those few milliseconds between typing "google.com" and the page actually loading? I did too, and honestly, it blew my mind when I finally understood it. Let me take you through what I learned about DNS — the unsung hero of the internet.

How Does a Browser Know Where a Website Lives?

Here's a question that got me curious: when you type a website address, how does your browser actually know where to go? It's not like the internet has a GPS, right?

Well, kind of — it does. It's called DNS, which stands for Domain Name System.

Think of DNS as the internet's phonebook. Back in the day, if you wanted to call someone, you'd look up their name in a phonebook to find their number. DNS does exactly that — it translates human-friendly names like example.com into computer-friendly addresses like 192.168.1.1.

Without DNS, we'd all be memorizing strings of numbers to visit websites. No thanks.

Why Do We Need DNS Records?

So DNS is a phonebook, cool. But a phonebook isn't just one giant list — it has structure. Similarly, DNS uses different types of records to store different kinds of information about a domain.

Need to know the IP address? There's a record for that. Need to know where to send emails? Different record. Need to verify you own the domain? Yep, another record.

Each record type solves a specific problem. Let's go through them one by one.


NS Record: Who's in Charge Here?

NS stands for Name Server.

Imagine you want to find someone's address, but first you need to know which phonebook to look in. NS records tell the internet: "Hey, if you want information about this domain, go ask these servers."

For example, when you buy a domain from a registrar like GoDaddy or Namecheap, they set up NS records pointing to their nameservers. If you later move to Cloudflare, you change the NS records to point to Cloudflare's servers instead.

In simple terms: NS records say "this server is responsible for answering questions about this domain."


A Record: The Main Address

The A Record is probably the most important one. The "A" stands for Address.

It maps a domain name directly to an IPv4 address — that's the classic format like 93.184.216.34.

When you type mywebsite.com and hit enter, the browser eventually asks: "What's the A record for this domain?" The answer is an IP address, and that's where your browser goes.

Real-life analogy: If your domain name is like your name, the A record is your home address. Simple.


AAAA Record: The Newer, Longer Address

As the internet grew, we started running out of IPv4 addresses (there are only about 4 billion possible combinations). Enter IPv6 — a newer format with way more possible addresses.

An IPv6 address looks something like this: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Yeah, it's long.

The AAAA record (pronounced "quad-A") maps a domain to an IPv6 address. It does the same job as an A record, just for the newer address format.

Why four A's? IPv6 addresses are four times longer than IPv4, so... four A's. Engineers can be funny sometimes.


CNAME Record: The Nickname

CNAME stands for Canonical Name, but I like to think of it as the "alias" or "nickname" record.

Instead of pointing to an IP address, a CNAME points one domain name to another domain name.

Let's say you have:

So when someone visits www.mywebsite.com, DNS first resolves it to mywebsite.com, then resolves that to the IP address.

Why is this useful? If your IP changes, you only update one A record. All the CNAMEs automatically follow along.

Common confusion: A records point to IP addresses. CNAMEs point to other domain names. Don't mix them up!


MX Record: Where Do Emails Go?

MX stands for Mail Exchange.

When someone sends an email to hello@mywebsite.com, how does their email server know where to deliver it? It looks up the MX record.

MX records point to the mail servers responsible for receiving emails for your domain. They also have a priority number — if the primary mail server is down, email gets routed to the backup.

Analogy: If A records are your home address, MX records are like your post office address. Different purpose, different destination.

Note: MX is for email routing, NS is for DNS authority. They're completely different things, even though both point to servers.


TXT Record: The Sticky Note

TXT records are the most flexible. They let you attach arbitrary text to your domain.

"Why would I need that?" Great question. Here are common uses:

  1. Domain verification: Google, Microsoft, and others ask you to add a specific TXT record to prove you own the domain.

  2. Email security: Records like SPF, DKIM, and DMARC (don't worry about these names yet) use TXT records to prevent email spoofing.

  3. General notes: Sometimes you just need to store some information.

Think of it as: A sticky note on your domain that anyone can read.


How It All Comes Together

Let's see how a real website might use all these records together.

Imagine I'm setting up coolproject.dev:

Record TypeNameValuePurpose
NScoolproject.devns1.cloudflare.comCloudflare manages my DNS
Acoolproject.dev104.21.50.123Main site IP address
AAAAcoolproject.dev2606:4700:3030::6815:327bIPv6 address
CNAMEwwwcoolproject.devwww subdomain redirects to main
MXcoolproject.devmail.zoho.comZoho handles my emails
TXTcoolproject.dev"v=spf1 include:zoho.com ~all"Email security
TXTcoolproject.dev"google-site-verification=abc123"Proves I own this domain

When someone visits my site, here's what happens:

  1. Browser asks: "Who handles DNS for coolproject.dev?" → NS record answers

  2. Browser asks that nameserver: "What's the IP?" → A/AAAA record answers

  3. Browser connects to that IP and loads the website

When someone emails me:

  1. Their email server asks: "Where do I send emails for this domain?" → MX record answers

  2. Email gets delivered to Zoho's servers

Everything works together like a well-organized system.


Wrapping Up

DNS might seem complicated at first, but once you break it down record by record, it starts making sense. Here's the quick recap:

  • NS: Who's responsible for this domain's DNS

  • A: Domain → IPv4 address

  • AAAA: Domain → IPv6 address

  • CNAME: Domain → Another domain name

  • MX: Where to send emails

  • TXT: Extra info and verification

The next time you visit a website, remember — there's a whole system of records working behind the scenes to get you there in milliseconds.

If you're just starting out with web development like me, understanding DNS is a superpower. It'll save you hours of confusion when you're deploying your first project and wondering why your domain isn't working.

Happy coding! 🚀


This article was written as part of my Web Dev Cohort 2026 journey. If you found it helpful, let me know!