DEV Community

Cover image for DNS Record Types Explained
Umar Hayat
Umar Hayat

Posted on

DNS Record Types Explained

🎙️ Introduction:

Hey reader — welcome back.

Wait… (huff) let me breathe.

This blog series is really giving me marathon vibes. Not because I’m running out of idea ideas — but because turning understanding into clear writing takes time, patience, and a lot of rewrites

As promised — I’m here with another network blog.

This is the third post in my networking series:

Blog 1: Networking Devices

Blog 2: How DNS resolution works

In the last blog, we explored how DNS works behind the scenes.
This time, we’ll go one layer deeper and understand DNS record types — the actual information DNS stores and serves.

Goal: give you technical jargon with simple meaning.

Let’s go 🚀


🌐 Why DNS Needs Records (Not Just Names)

Like we discussed in the last blog — the internet works with numbers, even though we use names.

But just having names and numbers isn’t enough.

The internet needs a reliable way to decide:

  • where to send web traffic
  • where to send emails
  • who controls a domain
  • how a domain proves its identity

DNS records exist to answer different questions about the domain.

Think of DNS records as instructions, not just mappings.

They tell the internet what to do with different kinds of requests.


❓ What is DNS? (Quick Revision)

Let’s quickly revise from the last blog.

High level DNS.png

DNS (Domain Name System) converts human-friendly domain names into IP addresses so browsers can load websites.

Humans prefer names. Machines prefer numbers.

Example:

When you search google.com, your system eventually needs something like: 142.250.190.14 to connect it further for information.

That’s how the connection actually happens.

We won’t go deeper here — we already covered that in — How DNS resolution works

Here, we’ll focus on DNS records.


📑 Why DNS Records are needed

A modern domain does many jobs, not just one.

The same domain may need to:

  • serve a website
  • route emails
  • act as an alias for another name
  • verify ownership for services
  • define who controls its DNS data

So one domain needs multiple kinds of information.

That’s where DNS records come in.

One domain contains many categories of information — that’s where DNS records comes into play.

Each DNS record solves one specific problem:

  • web traffic
  • email traffic
  • authority
  • verification
  • redirection

Instead of one overloaded answer, DNS gives clear, separate answers — using different record types.


🧩 The Core DNS Records (And the Problems They Solve)

Imagine if a domain handled only one type of data.

Email traffic would collide with web traffic.
Aliases would break.
Ownership would be unclear.

To keep things organized and scalable, DNS uses different record types to route different kinds of traffic.

Let’s go through them one by one.


🏛️ NS Record — Who is responsible for Domain

I explained NS records in my previous blog, but they’re important enough to revisit.

The NS (Name Server) record answers one simple question:

“Who should I ask next for the real DNS information?”

NS records define authority.

They tell the internet which name servers are responsible for a domain’s DNS data.

In simple terms:

  • NS records don’t point to websites
  • They don’t point to mail servers
  • They point to decision-makers

Example flow:

  1. A client requests google.com
  2. DNS checks which name servers are authoritative
  3. The request is delegated to ns1.google.com
  4. That server provides the next answer

In short:

  • NS records delegate responsibility
  • They don’t point to websites or mail servers

🖥️ A Record — Domain to IPv4 Address

The A record is the most common DNS record.

Its job is simple:

Map a domain name to an IPv4 address.

Example:

google.com → 142.250.190.14

When your browser loads a website, this is usually the record it ultimately needs.

Without A records, computers wouldn’t know where to send web requests.


📱 AAAA Record — Domain to IPv6 Address

The AAAA record does the same job as an A record — but with IPv6.

A record → IPv4

AAAA record → IPv6

IPv6 exists because IPv4 addresses are limited and mostly exhausted.

Important points:

  • AAAA does not replace A records
  • Both can exist together
  • Browsers prefer IPv6 if available

For most users, this happens automatically.

A vs AAAA.png


🔗 CNAME Record — One Name Pointing to Another

CNAME record - (Canonical Name record) maps one domain name (an alias) to another domain name (the canonical/true name)

CNAME

Instead of pointing to an IP address, it points to another domain.

Example:

`www.example.comexample.com`

DNS basically says:

“Go look at the real name instead.”

Analogy:

CNAME = nickname

A/AAAA = real address


📬 MX Record — How Email Finds Your Mail Server

MX record - (Mail Exchange record) record tells the world which mail servers are responsible for receiving email for a domain.

Web traffic and email traffic are handled differently

  • It tells the world which mail server is responsible for receiving emails for a domain.
  • Instead of pointing to an IP address, it points to mail server’s domain name.

In short: An MX record tells email where to go.


📝 TXT Record — Extra Information and Verification

TXT record - Text record

Originally, it was meant for human-readable notes.
Today, it’s mostly used by machines.

  • It lets you add any text information to your domain’s DNS
  • It doesn’t point to IP addresses or domains
  • It holds text used for verification and security

In short:

  • TXT records store proof and instructions

🔄 How All DNS Records Work Together for One Website

Individually, each record is simple.

Together, they form a coordinated system.

Each one handles a specific responsibility, but together they ensure that:

  • websites load correctly
  • emails are delivered
  • domains are secure
  • ownership is clear

🌍 A DNS Setup for a single domain

FullDNS

A typical DNS setup includes:

  • A / AAAA → Web server IPs
  • CNAME → Aliases (like www)
  • MX → Email routing
  • TXT → Verification and security
  • NS → Authoritative name servers

Simple Example

For example.com:

  • A93.184.216.34
  • CNAMEwww.example.com → example.com
  • MXmail.example.com
  • TXT"v=spf1 include:_spf.google.com ~all"
  • NSns1.hosting.com, ns2.hosting.com

🤔 Common Beginner Confusions

If this feels heavy, that’s normal.

DNS takes time to fully click.

Let’s clear some common doubts.

  1. IPv4 vs IPv6
    • IPv4: 32-bit addresses (~4.3 billion)
    • IPv6: 128-bit addresses (~3.4×10³⁸)

IPv6 is more scalable, efficient, and future-proof.


  1. A vs CNAME
    • A record → domain to IP address
    • CNAME → domain to another domain

A = direct address

CNAME = nickname


  1. NS vs MX

    • NS → who controls the domain’s DNS
    • MX → who handles email for the domain

    NS → the “phonebook” that stores all DNS records

    MX → the “mailroom” that directs email to the right server


💡Ending Thought

DNS isn’t magic — it’s a system of organized answers.

Each DNS record has a clear role:

  • A and AAAA connect domains to servers
  • CNAME handles aliases
  • MX routes email
  • TXT verifies and secures
  • NS defines authority

They work quietly in the background — like hardworking parents — making sure everything reaches the right place.

And honestly, that’s what good internet infrastructure looks like.

Top comments (0)