Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

A simple guide to A, AAAA, CNAME, MX, and more

Published
4 min readView as Markdown
DNS Record Types Explained
T

MERN Stack developer focused on building real-world web applications. Currently exploring Generative AI and modern backend practices. I write about what I learn, build, and break along the way.

1. What is DNS

DNS (Domain Name System) is the system that converts human-friendly names into the computer-friendly addresses.

ChaiCode.com  -> 172.67.213.172

DNS is the internet’s phonebook.

2. Why DNS Record are needed

DNS record are needed because one domain needs to store many kinds of information not just one IP.

A domain is used for :

  • Website

  • Email

  • API’s

  • Security

  • Verification

  • Load Balancing

All of this needs the different data.

DNS records exist to attach the real world digital information to a domain name.

3. What is NS Record

NS (Name Server) record tells who is responsible for a domain.

NS record points to the authoritative DNS servers for a domain

Example:

Chaicode.com NS    -> ns1.ChaiCode.com
Chaicode.com NS    -> ns2.ChaiCode.com

It means if you want any information about the Chaicode.com ask to these servers.

4. What is A Record

A record tells the exact IPv4 address of a domain.

Example:

ChaiCode.com  -> 172.67.213.172

Think like you are inviting you friend virat to your home.

you tell them name of your house Tejas’s villa (ChaiCode.com) they can’t find you home but if give them your address like Gokuldam society wing B room no : 2 powder galli goregaon east 564-234 (172.67.213.172 )them this address then your friend come you house.

A record is the house address of a website.

5. What is AAAA Record

AAAA record tells the exact IPv6 address of a domain.

It is just a modern version of the A record.

ChaiCode.com  -> 2607.f8b0.080a::300e

Think of it’s like IPv4 is short phone number and IPv6 is a international long phone number.

AAAA record tells the same house address but using the modern address system.

6. What is CNAME Record

CNAME (Canonical Name) record is an alias for another domain name.

CNAME is nickname.

Example:

www.chaicode.com   ->  chaicode.com

This means www.chaicode.com is just a another name for chaicode.com

Think of it’s like ,

Real name : Virat Kohli

Nickname : King Kohli

Both refer to the same person, CNAME works the same way.

Different names → same destination.

CNAME doesn’t tell you where something is it tells you what its real name is.

7. What is MX Record

MX (Mail Exchange) record tell where emails for domain should be delivered.

MX record is the post office of domain.

chaicode.com    ->    mail.google.com

Think of it’s like ,

All letters of for Chaicode.com should be delivered to the mail.google.com

chaicode.com MX tell which company handle’s chaicode emails.

8. What is TXT Record

TXT (text) record stores extra information about the domain.

TXT record is public notice board for domain.

Chaicode.com TXT -> "google-site-verification=abc123"

This domain proves it is owned by this account.

Think of it’s like , on chaicode website there is page

This X account is owned by the Chaicode Pvt Ltd

TXT record is the domains official public message board used to prove identity and security.

9. What problem each record solves

  1. NS Record
  • Problem : DNS can’t be centralized

  • Solution : defines who control the domain.

  1. A Record
  • Problem : Browsers understand numbers not names

  • Solution : maps domain to IPv4 address

  1. AAAA Record
  • Problem : IPv4 is running out

  • Solution : maps domain to IPv6 address

  1. CNAME Record
  • Problem : One service need multiple names

  • Solution : makes one domain an alias of another.

  1. MX Record
  • Problem : Emails need delivery system

  • Solution : Routes mail to mail servers

  1. TXT Record
  • Problem : Need ownership proof

  • Solution : stores verification and security rules.

10. How a single domain uses multiple records together

Let’s take example of chaicode.com :

  1. Website
Chaicode.com -> A -> 104.21.12.34

It gives A record for Chaicode.com

  1. WWW version
www.chaicode.com  -> CNAME  -> chaicode.com

Different names but single destination.

  1. Email
chaicode.com -> MX -> mail.google.com

where the chaicode email will go .

  1. Ownership
chaicode.com -> NS  ->  ns1.cloudflare.com

Who controls the DNS for chaicode.

  1. Verification and security
chaicode.com -> TXT -> "google-site-verification=xyz"
chaicode.com -> Txt -> "v=spf1include:_spf.google.com~all"

It handles the identity and security.

11. Common beginner confusions

  1. A record Vs CNAME record

A points to an IP address and CNAME points to another domain name.

A record tells where it is and CNAME record tells what its real name is.

  1. NS record Vs MX record

NS tells who controls the domain and MX tells where emails should be delivered.

NS record is like domain name and MX record is like domain’s post office.

Final Thought

DNS records are like domain’s ID card each one gives specific instructions that makes the domain fully usable on the internet.

Networking Fundamentals for Beginners

Part 4 of 6

In this series, I share my journey of learning computer networking from scratch. I explain core concepts like network devices and DNS in simple language for beginners who want clear fundamentals without feeling overwhelmed.

Up next

Getting Started with cURL

A beginner’s guide to making HTTP requests from the terminal