Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

DNS : A beginner-friendly explanation of A, AAAA, CNAME, MX, TXT, and NS records.

Updated
5 min read
DNS Record Types Explained

⤷ When you type any website like take my personal website as an example : prakashtsx.me . How does your browser know where that website actually lives ?

Probably you will say it lives at domain address like .com .in or any other domain .

But that not the case .

⤑ You know A domain name is only a name , not an address.

⤑ Your browser needs the real server address (as IP address) to load a website.

⤑ This is where DNS (Domain Name System) comes in .

✢ DNS is the phonebook of the Internet.
⤑ It translates human-friendly names into machine-friendly addresses, so browsers can find the correct server.

✢ In this article, we will learn exactly how DNS works and what each DNS record does using real examples from my website :


1. What DNS Is ?

⤷ Imagine you want to visit a friend’s house.

You know their name, but not their address.

So you check your phone contacts → the contact shows the address → you travel there.

✢ DNS works the same way.

  • You type prakashtsx.me

  • Your browser doesn’t know the IP

  • DNS tells the browser the correct server address

  • Browser loads the website

2. Why DNS Records Are Needed ?

⤷ A domain is not just a website.
It can have:

  • Subdomains (blog.prakashtsx.me)

  • Email servers

  • Verification settings

  • Aliases

  • IPv4 and IPv6 addresses

  • Name servers (authoritative DNS)

⤑ To manage all of this, DNS uses different record types, each with a specific purpose.

⤑ Think of DNS as a file with different sections:

  • One section says : This domain belongs to this server.

  • Another says : This is the mail server.

  • Another says : This subdomain points here.

These sections are called DNS Records.

3. NS Record (Name Server Record)

Who is responsible for this domain?

⤷ NS records tell the world which DNS servers contain the real (authoritative) information for a domain.

You used the command:

nslookup -type=ns prakashtsx.me

The DNS resolver replied with:

prakashtsx.me  nameserver = dns1.registrar-servers.com
prakashtsx.me  nameserver = dns2.registrar-servers.com

✢ What this means:

These two servers are the “authoritative DNS servers” for your domain.

In simple words:

They are the official place where the REAL DNS records of prakashtsx.me live.

⤑ If the entire internet wants to know:

They will ask these two servers, because these servers are responsible for your domain.

4. A Record (Address Record IPv4)

Which IPv4 server does this domain point to ?

The most common DNS record.

It maps a domain → IPv4 address.

Output from nslookup prakashtsx.me :

prakashtsx.me → A → 216.198.79.1

Meaning:

When someone types prakashtsx.me, DNS tells the browser to go to 216.198.79.1.

5. AAAA Record (IPv6 Address Record)

Which IPv6 server does this domain point to ?

Same as A record, but for IPv6.

Example:

prakashtsx.me → AAAA → 2606:4700::abcd

(Your domain may or may not have AAAA many small sites skip IPv6.)

Some of you ask me what is IPv4 and IPv6 . So please refer to below i have write it properly which can help you to understand the main difference between both .

IPv4 (Internet Protocol Version 4)

This is the older and most common type of IP address.

Example:

216.198.79.1

Structure

  • 4 numbers

  • Each between 0–255

  • Separated by dots

  • Total ≈ 4.3 billion possible addresses

Why IPv4 is not enough?

⤑ The world ran out of IPv4 addresses because every device needs one:

  • Phones

  • Laptops

  • Smart TVs

  • Servers

  • Cameras

  • IoT devices

We needed a newer, bigger system.


IPv6 (Internet Protocol Version 6)

This is the newer version with almost unlimited addresses.

Example:

2606:4700:3033::ac43:bdff

Structure

  • Hexadecimal (0-9, a-f)

  • Separated by colons

  • Extremely large address space

  • Total = 340 undecillion (3.4 × 10³⁸) addresses
    → Enough for every grain of sand on Earth to have millions of IPs

Why IPv6 exists?

To handle:

  • Billions of new devices

  • Faster routing

  • More efficient networks

  • Better security (built-in features)


How It Relates to DNS

DNS records are simply:

  • A Record → Domain → IPv4
    Example:
    prakashtsx.me → 216.198.79.1

  • AAAA Record → Domain → IPv6
    Example:
    example.com → 2606:4700:3033::1

Both point your domain to a server just using two different formats.

6. CNAME Record (Canonical Name / Alias)

This domain is actually another name.

CNAME is used when :

⤑ One domain should point to another domain.

Output from nslookup:

blog.prakashtsx.me → CNAME → hashnode.network
hashnode.network → A → 76.76.21.21

Meaning :

  • Your blog subdomain is an alias

  • It points to Hashnode’s domain

  • Hashnode automatically provides the final IP

CNAME is perfect for:

7. MX Record (Mail Exchange Record)

Where should email for this domain be delivered ?

If someone sends email to :

mail@prakashtsx.me

⤑ The sending email server checks the domain’s MX records to find the correct mail server.

Example:

prakashtsx.me → MX → mailhost.someprovider.com

Without MX records, a domain cannot receive email.

8. TXT Record (Text / Verification / Security)

⤑ TXT records store extra information.

⤑ Originally created for notes, now heavily used for security.

Common uses:

SPF (Email authentication)

⤑ Specifies which servers are allowed to send mail for your domain.

Example:

v=spf1 include:_spf.google.com ~all

DKIM (Email signature keys)

DMARC (Email protection rule)

Domain Verification

  • Google Search Console

  • Cloudflare

  • AWS

  • GitHub Pages

  • Hashnode

  • etc.

Example:

google-site-verification=abc123xyz

⤑ TXT is extremely flexible and widely used.

9. Simple Diagram: DNS Flow