Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

From "how does a browser know where a website lives?" to a complete DNS setup — no jargon, just clarity.

Published
9 min read
DNS Record Types Explained

Contents

  1. What is DNS?

  2. Why DNS Records?

  3. NS Record

  4. A Record

  5. AAAA Record

  6. CNAME Record

  7. MX Record

  8. TXT Record

  9. All Together


01. What is DNS?

Let's start with a question you've probably never had to think about: How does your browser actually know where to go when you type google.com?

Computers don't understand words like "google.com". They speak in numbers — specifically, IP addresses like 142.250.80.46. Every server on the internet has a unique IP address, and that's how computers actually reach each other.

But nobody wants to memorise a number like that. So the internet came up with a clever trick: a massive, distributed phonebook that translates human-friendly names into computer-friendly numbers. That phonebook is called DNS — the Domain Name System.

💡 Think of DNS as your phone's contact list. You don't memorise your friend's phone number — you tap their name. DNS does exactly that for websites: you say "google.com," and DNS whispers back "142.250.80.46".

This whole conversation — asking DNS, getting the IP, connecting to the server — happens in milliseconds, every single time you visit a website. DNS is the invisible glue of the internet.

02. Why DNS Records Are Needed

A domain like myshop.com is just a name. On its own, it does nothing. It needs instructions — where is the website? Where do emails go? Who manages this domain? These instructions are stored as DNS records.

Think of your domain as an empty house you just bought. DNS records are the signs you put up: the door number (IP address), the mailbox label (for email), the property title (who's in charge). Without these records, nobody — and nothing — can find you.

📋DNS records are just text entries stored in a DNS zone file. Each record has a type, a name, and a value. Different record types answer different questions about your domain.

Let's go through each record type one at a time — no jumping ahead, I promise.

NS — Name Server

03. NS Record

Who is responsible for this domain?

Before any other DNS record can be found, something needs to answer: "Who should I ask about this domain?" That's the NS record's job.

NS stands for Name Server. It tells the internet which servers hold the authoritative DNS records for your domain. Think of it like a receptionist at the entrance of a building — the NS record directs all questions to the right department.

🏢 Imagine calling a company. The switchboard operator says "For billing questions, press 1 — for tech support, press 2." NS records work the same way — they say "For questions about myshop.com, ask these servers."

;; NS Records for myshop.com myshop.com. IN NS ns1.cloudflare.com. myshop.com. IN NS ns2.cloudflare.com.

💡You typically set NS records when you register your domain and point it to your hosting provider or Cloudflare. You rarely need to change them again.

04. A Record

Domain → IPv4 Address

The A record is the most fundamental DNS record. It answers one question: what is the IPv4 address of this domain?

IPv4 addresses look like four numbers separated by dots — 192.168.1.1 — and they've been the backbone of the internet since day one. When you type myshop.com in your browser, an A record tells it exactly which server to connect to.

🏠 Your domain name is like your name on an envelope. Your IP address is like your physical street address. The A record is what your postal worker looks up to actually know where to deliver your mail.

;; A Records for myshop.com myshop.com. IN A 93.184.216.34 www.myshop.com. IN A 93.184.216.34

You can also have multiple A records pointing to different IP addresses — this is how large websites balance traffic across many servers (called load balancing).

5. AAAA Record

Domain → IPv6 Address

The AAAA record does exactly the same job as the A record — it maps a domain name to an IP address. The difference is the type of IP address: instead of IPv4, it uses IPv6.

IPv4 addresses (like 93.184.216.34) use 32 bits and can only create about 4 billion unique addresses. The internet grew too big for that. IPv6 uses 128 bits and can create an almost incomprehensibly large number of addresses — enough for every grain of sand on Earth to have its own address, many times over.

📬 If IPv4 is a 4-digit mailbox number, IPv6 is a 32-character serial code. Longer and harder to read, but the internet has billions more devices now than anyone expected.

;; AAAA Record — IPv6 myshop.com. IN AAAA 2606:2800:220:1:248:1893:25c8:1946

✅Most modern websites have both an A and an AAAA record. Browsers try IPv6 first (if supported) and fall back to IPv4 automatically. You don't have to choose — you can have both!

06. CNAME Record

One name pointing to another name

A CNAME record doesn't point to an IP address — it points to another domain name. It's essentially an alias. When someone looks up the CNAME, they then follow that name to find the actual IP address.

This is incredibly useful for subdomains. Instead of remembering what IP address www.myshop.com uses, you can just say "it's the same as myshop.com — follow that".

📞 Imagine "Ask for Lena" when you call a company. You don't need to know her direct line — you just follow the chain until you reach the actual person. CNAME is the DNS version of "ask for Lena."

;; CNAME Records www.myshop.com. IN CNAME myshop.com. shop.myshop.com. IN CNAME myshop.com. blog.myshop.com. IN CNAME mybloghost.com.

⚠️A vs CNAME — the common confusion:
An A record maps a name directly to an IP address. A CNAME maps a name to another name (which then has its own A record). Use A records for your root domain; use CNAMEs for subdomains and aliases. You cannot use a CNAME on a bare domain root (like myshop.com itself) — only on subdomains.

07. MX Record

How emails find your mail server

When someone sends an email to hello@myshop.com, the sending mail server needs to know: where do I deliver this? That's what the MX record answers. MX stands for Mail Exchange.

MX records are slightly different from A or CNAME records — they include a priority number. A lower number means higher priority. If your primary mail server is down, the sending server will try the backup server (with the higher priority number) instead.

📬 Think of MX records like a post office sorting system. First, try the main sorting centre (priority 10). If it's overwhelmed, use the backup facility (priority 20). Email works exactly the same way.

;; MX Records — priority determines order myshop.com. IN MX 10 mail1.googlemail.com. myshop.com. IN MX 20 mail2.googlemail.com.

📌NS vs MX — another common mix-up: NS records say who manages DNS for a domain. MX records say who handles email for a domain. They're totally separate concerns, pointing to different servers entirely.

08. TXT Record

Extra information and verification

TXT records are the wildcard of DNS. They store plain text data in your DNS zone, and they're used for all sorts of purposes — from proving you own a domain to telling email servers how to handle messages from you.

Here are the three most common uses you'll see in the wild:

SPF — Who can send email on your behalf?

SPF (Sender Policy Framework) tells the world which mail servers are allowed to send emails from your domain. It helps prevent spammers from faking your email address.

;; SPF record myshop.com. IN TXT "v=spf1 include:_spf.google.com ~all"

DKIM — Signing your emails

DKIM adds a digital signature to outgoing emails so the recipient can verify they genuinely came from you and weren't tampered with in transit.

;; DKIM public key google._domainkey.myshop.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjAN..."

Domain Verification

Google, GitHub, and other services ask you to add a TXT record to prove you actually own the domain before granting you access or analytics.

;; Google site verification myshop.com. IN TXT "google-site-verification=abc123xyz..."

🎯TXT records are read by software, not browsers. They're invisible to your website visitors but are constantly checked by email services, security scanners, and third-party tools to verify who you are and how you operate.

09. How All DNS Records Work Together

Now that you understand each record type, let's see how a single, real-world domain uses them all at once. Here's a complete DNS setup for myshop.com — a small online shop with a website, email, and a blog.

📋 Complete DNS Zone: myshop.com
;; ── Name Servers (who manages this domain) ──────────────
myshop.com. 3600 IN NS ns1.cloudflare.com.
myshop.com. 3600 IN NS ns2.cloudflare.com.

;; ── A Records (IPv4 address for the website) ────────────
myshop.com. 300 IN A 93.184.216.34
www.myshop.com. 300 IN CNAME myshop.com.

;; ── AAAA Record (IPv6 address) ─────────────────────────
myshop.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946

;; ── CNAME (blog hosted elsewhere) ──────────────────────
blog.myshop.com. 300 IN CNAME myshop.ghost.io.

;; ── MX Records (email routing) ──────────────────────────
myshop.com. 3600 IN MX 10 mail1.googlemail.com.
myshop.com. 3600 IN MX 20 mail2.googlemail.com.

;; ── TXT Records (verification + email security) ─────────
myshop.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"
myshop.com. 3600 IN TXT "google-site-verification=abc123..."
google._domainkey.myshop.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjAN..."

Quick Reference

Record Full Name What it does Example value
NS Name Server Who manages DNS for this domain ns1.cloudflare.com
A Address Domain → IPv4 address 93.184.216.34
AAAA Quad-A Domain → IPv6 address 2606:2800:220:1:...
CNAME Canonical Name Name → another name (alias) www → myshop.com
MX Mail Exchange Where to deliver email 10 mail1.google.com
TXT Text Verification, SPF, DKIM, custom data "v=spf1 include:..."

✓You've Got This

DNS can feel intimidating at first — but once you see each record type as solving one specific problem, it all clicks. Your domain name is just a label. DNS records are the instructions that make it actually do things.

Every website you visit, every email you send, every service you verify — DNS records are silently doing their job behind the scenes, translating human-friendly names into the numbers that computers understand.