Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
8 min read
DNS Record Types Explained

While visiting any website you might have had a question “How does a browser know where a website lives?**. Well, the answer lies in the DNS (Domain Name System).

What is DNS?

The Domain Name System (DNS) is often called the Internet’s phonebook. It translates human-readable domain names (e.g., youtube.com) into machine-readable addresses (like 142.250.190.14). It is a decentralized, hierarchical system that allows users to navigate the web using simple names instead of remembering complex, numerical IP addresses.

youtube.com ———> 142.250.190.14

In this blog, we’ll discuss the various DNS Records, their need & how they work together for each website.


🤔 Why Are DNS Records Needed?

DNS records are essential “instructions or rules" that are attached to your domain.

A domain is not just a website. Behind a single domain name, you might have:

  • 🌍 A web server (serving your website)

  • 📧 An email server (handling emails)

  • 🔀 Subdomains (like blog.example.com or docs.example.com)

  • Verification records (for services like Google or Microsoft)

  • 🚀 CDN configuration (to speed up global delivery)

And how does the internet know where each of these lives?

That’s where DNS records come in.

They tell the internet: “For this domain, here’s what does what.”

Each record solves a specific problem.


  1. NS Record — Who Is Responsible?

An NS (Name Server) record tells the internet:

“These are the servers officially responsible for this domain.”

In simple terms, an NS record defines who manages the DNS for a domain.

  • It doesn’t point to a website.

  • It doesn’t handle email.

It says:

“If you want answers about this domain, ask these servers.”

🏢 Real-Life Example: The Company Front-Desk

Imagine a company called example.com. Now think of the domain like a large office building.

At the entrance, there’s a front-desk.

If someone walks in and asks:

  • “Where is the Sales department?”

  • “Who handles HR?”

  • “Where should I deliver this package?”

The front-desk person directs them to the correct department.

👉 That receptionist is like the Name Server.

The NS record tells the world:

“These are the official front-desk for this building.”

🌍 How It Works on the Internet

Let’s say someone types: example.com

The DNS system eventually asks:

“Who is responsible for answering questions about this domain?”

The NS record responds with something like:

Internet User
     ↓
asks: "Who manages example.com?"
     ↓
Root DNS Server
     ↓
answers: "Ask ns1.hostingprovider.com"
     ↓
ns1.hostingprovider.com | ns2.hostingprovider.com
     ↓
"I have all the records for example.com!"

This means:

“Go ask these name servers — they manage everything for this domain.”

From there, those name servers provide all other DNS records:

  • A records (website IP)

  • MX records (email routing)

  • TXT records (verification, security) & more

🔑 Why NS Records Matter

Without NS records:

  • The internet wouldn’t know where to ask for DNS information.

  • Your domain wouldn’t resolve.

  • Nothing (website, email, API) would work.

NS records define authority.

They answer the critical question:

“Who is officially responsible for this domain?”


  1. 🏠 A Record (Address Record)

An A (Address) record is the DNS record that connects a domain name to an IPv4 address (Domain → IPv4 address).

💡
It tells the internet:If someone visits this domain, send them to this server IP.”

Example:

example.com  →  192.0.2.1 (IPV4 Address)

Now when someone types example.com in their browser:

  1. DNS looks up the A record.

  2. Finds the IPv4 address.

  3. Sends the visitor to that server.

  4. The website loads.

🏠 Real-Life Analogy

Think of a domain like a person’s brand-name: johnsgrocery.com

  • But computers don’t understand names (johnsgrocery.com). They understand numeric addresses — like a street address.

  • The A record is like saying: “John’s Grocery is located at 123 Main Street.”

Without that address, no one knows where to go.

🔍 What Makes It Important?

  • It connects your domain to your web server

  • It’s required for most websites to work

  • It only works with IPv4 addresses (numbers like 203.0.113.10)

If you change hosting providers, you usually update your A record to point to the new IP address.


  1. AAAA Record (IPv6 Address Record)

"What is the IPv6 address of this domain?"

AAAA records do the same job as A records, but for the newer IPv6 addresses (longer addresses with letters and numbers).

Example:

example.com  →  2606:2800:220:1:248:1893:25c8:1946

Why both A and AAAA?
Some devices use the old address system (IPv4), some use the new one (IPv6). Having both ensures everyone can find you!

Real-world analogy:
Like having both a street address and GPS coordinates for your house. Different people use different systems to find you.

Diagram:

Modern Device (IPv6)          Old Device (IPv4)
        ↓                            ↓
    AAAA Record                  A Record
        ↓                            ↓
  2606:2800:...                93.184.216.34
        ↓                            ↓
    Both reach the same website!

🔍 Why AAAA Records Matter

  • IPv6 supports vastly more devices worldwide.

  • Many modern networks prefer IPv6.

  • Future-proof infrastructure relies on IPv6 adoption

Most modern websites use both:

  • A record (IPv4)

  • AAAA record (IPv6)

This allows users to connect using whichever protocol their network supports.


  1. CNAME Record (Canonical Name Record)

A CNAME (Canonical Name) record is a DNS record that makes one domain name point to another domain name.

Example:

www.example.com  →  example.com  →  93.184.216.34
blog.example.com →  hosting.blogprovider.com → 104.26.12.45

Real-world analogy:

Your friend goes by a nickname. When someone asks for "MJ," you say "Oh, you mean Mike Junior." They then look up MJ’s address.

Common confusion: A vs CNAME

  • A Record: Points directly to an IP address (final destination)

  • CNAME: Points to another domain name (which then resolves further)

Diagram:

User wants: blog.example.com
                ↓
         CNAME Record says: "That's actually 'hashnode.network.'"
                ↓
         Look up hashnode.network.
                ↓
         A Record: hashnode.network. → 104.26.12.45
                ↓
         Final destination reached!

Common confusion: A vs CNAME

  • A Record: Points directly to an IP address (final destination)

  • CNAME: Points to another domain name (which then resolves further)

Problem it solves

Sometimes you want multiple domain names to point to the same server, but you don’t want to manage multiple IP addresses.

  • Without CNAME, every name(subdomain) would need its own A or AAAA record.

  • With CNAME, you can alias one name to another, so if the target’s IP changes, you only update it in one place.


  1. MX Record (Mail Exchange Record)

How does the sending server know where to deliver the email?

  • MX records tell the internet: “For emails to mail.example.com, send them here.

Without MX records, email servers wouldn’t know where to deliver messages, and emails would bounce.

Example:

example.com  MX  10 alt4.aspmx.l.google.com.
  • 10 → priority (lower number = higher priority)

  • alt4.aspmx.l.google.com. → hostname of the mail server

When someone sends an email to alice@example.com:

  1. Sending server looks up the MX record for example.com.

  2. Finds alt4.aspmx.l.google.com..

  3. Resolves alt4.aspmx.l.google.com. to an IP (via A/AAAA record).

  4. Connects to that server to deliver the email.

Real-World Analogy

  • Domain = example.com → a city.

  • MX records = post offices in the city.

  • Priority = which post office the mail should go to first.

  • Multiple MX’s = backup post offices if the first is closed.

So email delivery is reliable even if one server is temporarily down.

Common confusion: NS vs MX

  • NS Record: Who manages ALL your domain's DNS records

  • MX Record: Where to send EMAIL specifically

Someone sends email to: user@example.com
            ↓
    DNS lookup for MX records
            ↓
    MX Priority 10: mail1.emailprovider.com
    MX Priority 20: mail2.emailprovider.com
            ↓
    Try mail1 first (lower number = higher priority)
            ↓
    If mail1 is down, try mail2
            ↓
    Email delivered!

  1. TXT Record (Text Record)

The DNStext’ (TXT) record lets a domain administrator enter text into the Domain Name System (DNS). It is a flexible note attached to a domain to solve verification, security, or metadata problems.

Example:

example.com  TXT  "v=spf1 include:_spf.google.com ~all"

It tells other email servers:These servers are allowed to send emails for example.com

Real-world analogy:

It is like a sticky-note / notice attached to a house (domain) that tells visitors (bots) special instructions (or) verifies who owns this house (domain).

They don’t direct traffic, they just provide information.

Problem it solves

A TXT record solves problems by acting as a publicly accessible database for a domain. Because only someone with administrative access to a domain's DNS settings can add or change these records, external services use them as a "source of truth" to verify identity and confirm authorized behavior.

Example problems TXT records solve:

    1. Proving ownership of a domain for services (Google, Hashnode, etc.)

      1. Email authentication to prevent spam (SPF, DKIM, DMARC)

      2. Custom instructions or metadata for external services

  • Without TXT records, there would be no standardized way to publish this information in DNS.


How all DNS records work together for one website?

  • User types: https://blog.example.com

  • DNS Resolver asks:

    • NS record → who’s authoritative

    • A/AAAA record → server IP

    • CNAME (if alias exists) → resolve canonical name → IP

  • Browser connects to server IP

  • TLS handshake: Browser checks SSL certificate

    • TXT record may have been used to verify ownership for SSL
  • HTTP request: Host header tells server which site to serve

  • Email: MX + TXT records handle email delivery and authentication

  • Other services: TXT records used for verification or instructions

🌟 Visual Analogy

Think of a domain as a mall:

RecordMall AnalogyPurpose
A / AAAABuilding addressVisitors find the building
CNAMENickname for buildingEasy-to-remember alias
NSMall managerKnows all official addresses
MXPost officeHandles all letters/emails
TXTNotes on buildingProve ownership, provide instructions

Conclusion

DNS may seem invisible, but it’s the backbone of the internet. Each record plays a vital role:

  • A/AAAA → “What’s the server IPv4 / IPv6?”

  • CNAME → “Can this name point to another name?”

  • NS → “Who manages this domain?”

  • MX → “Where do emails go?”

  • TXT → “How can I verify or provide instructions for my domain?”

Together, these records work seamlessly behind the scenes, making websites, emails, and domain-based services reliable, secure, and easy to manage. Understanding how they interact helps you take control of your domain and troubleshoot issues like a pro.

More from this blog

Syed Minhaj Hussain

16 posts