DNS Record Types Explained

Have you wonder how browser’s know “when we type google.com” then what happen?
as i though ealier it simply go to google.com domain and showing me website that hosted, i never bother think there will be something that working behine the sence, i know ip address stuff that time too but never tought is google.com is name which ultimately pointing to A record (which is Ip address).
so, tell simply google.com is name for human to remember easy becase humans can’t remember so, many ip address like 1.234.56 stuffs every domain,
suppose you have
google.com
masterji.co
chaicode.com
so, easy but what if i give you like this
142.250.80.110
172.67.131.7
172.67.213.172
Now, just imagine the worst case senario, might be you have to remember 20 of ip address, so it’s hard human to remember but computers don’t understand names, They speak in numbers called IP addresses. DNS (Domain Name System) is the magic "phonebook" that translates the names we remember into the numbers computers use.
+---------+ +---------+ +---------+
| Browser | -----> | DNS | -----> | Server |
+---------+ +---------+ +---------+
| | |
| 1. Request URL | |
|----------------->| |
| | 2. Resolve IP |
| |----------------->|
| | |
| 3. IP Address | |
|<-----------------| |
| |
| 4. HTTP Request (to IP) |
|------------------------------------>|
| |
| 5. HTTP Response |
|<------------------------------------|
What is DNS (Domain Name System) ?
The Domain Name System is the internet’s phonebook that only know whom to talk next? meaning it maps easy to remember domain name to ip addresses that computers use to identify.
Additionally, DNS is not in one place, it is a, global, decentralized system.
Why DNS records are needed ?
If DNS is the phonebook, records are the individual details under a contact's name. One contact might have a home address, a work email, and an alias.
Similarly, a domain needs different records to handle different tasks—like showing a website, receiving an email, or proving you own the domain.
that’s why we need different dns records like A, NS, AAAA, CNAME, MX. TXT etc.
What an NS Record is (who is responsible for a domain)
Let see the problem first to understand NS record: How does the internet will know which "phonebook" holds your domain information? The Solution is: The NS (Name Server) Record.
The NS record tells the world which provider (Company) is responsible for your domain’s settings (like GoDaddy, Cloudflare, or Bluehost). It’s like saying, "If you want to know where 'example.com' lives, go ask the receptionist at this specific office."
What an A Record is (domain → IPv4 address)
A record stands for address, this is main record should have, it maps a domain name to an IPv4 address (the classic 4-part numbers like 123.45.67.89) so, why this is important?
See, you have a domain name, but you need to point it to your physical web server where your website is hosted so, the Solution is A Record.
What an AAAA Record is (domain → IPv6 address)
It does the exact same thing as an A record, but for the newer, longer IP addresses (like 2001:0db8:85a3...) so, why we need IPv6 (AAAA) if work same as (A) record?
IPv4 uses 32-bit addresses, allowing about 4.3 billion IPs, which are now exhausted due to internet growth. IPv6 was introduced with 128-bit addresses, providing a larger address space to solve this limitation and support future expansion.
In simple terms, it's just a scalability issue with the A record, so the new v6 address was introduced.
+-------------+ +-------------------+
| Browser | -----> | DNS |
+-------------+ +-------------------+
|
| Query: example.com
|
+-----------+-----------+
| |
A Record (IPv4) AAAA Record (IPv6)
93.184.216.34 2606:2800:220:1:248:1893:25c8:1946
| |
+-----------+-----------+
|
| Response: IP address
|
+-------------+
| Server |
+-------------+
What a CNAME Record is (one name pointing to another name)
A CNAME points one name to another name instead of a number or IP address. Why is this useful?
Imagine if Cloudflare gave you an IP address instead of NS records. When Cloudflare updates their machines, the IP address changes. It would be very impractical for Cloudflare to inform each customer to update their IP address.
Instead, if Cloudflare uses a CNAME record and provides NS records to customers, they can update their machines and then update the A record for their main domain. This way, the NS records are updated automatically. That's why a CNAME is needed for pointing one name to another.
But, you might be confuse with NS records and CNAME here as i said “if Cloudflare uses a CNAME record and provides NS records to customers” so let me explain:
NS record = Who manages my DNS?
CNAME record = This domain name points to another domain name
(example.com to blog.example.com)
A record = This domain name points to an IP (example.com to 123.45.67.89)
+---------+ +-------------------+
| Browser | -----> | DNS |
+---------+ +-------------------+
|
| Query: www.example.com
|
+------+--------------------+
| |
CNAME Record (Alias)
www.example.com ─────────────▶ example.net
|
| Query: example.net
|
+----------+----------+
| A / AAAA Record |
| 123.45.67.89 / |
| 2606:2800:... |
+----------+----------+
|
| Response: IP
|
+-----------+
| Server |
+-----------+
What an MX Record is (how emails find your mail server)
An MX (Mail Exchange) record tells the internet which mail server receives emails for a domain.
When someone sends an email to user@example.com, the sender’s server checks the MX record of example.com to know where to deliver the email (Google Workspace, Outlook, etc.)
Without an MX record, email delivery fails.
+---------+ +-------------------+ +----------------+
| Sender | ----> | DNS | ----> | Mail Server |
| Client | | | | (Recipient's) |
+---------+ +-------------------+ +----------------+
| | |
| 1. Send email to | |
| user@example.com| |
|------------------>| |
| | 2. Query MX record for |
| | example.com |
| |------------------------>|
| | |
| | 3. DNS responds with |
| | mail server(s) |
| |<------------------------|
| | |
| 4. SMTP connection to MX host |
|-------------------------------------------->|
| | |
| 5. Email delivered to recipient mailbox |
|<--------------------------------------------|
Do We Need MX Records If We Use Gmail?
Yes, Gmail also uses MX records. For example, gmail.com has MX records pointing to Google’s mail servers. MX records are a core part of how email works for every provider.
Why Not Just Use a Gmail Address?
You can use example@gmail.com, but it’s not ideal for businesses:
Anyone can create similar addresses
It looks less professional
It’s harder to trust or verify the sender
Why Businesses Use Custom Domains?
Using info@example.com
Builds brand identity
Increases trust
Prevents impersonation
To use Gmail or Outlook with a custom domain, MX records are required too.
What a TXT Record is (extra information and verification)
A TXT record is basically a "sticky note" of text attached to your domain. It doesn't "do" anything on its own, but other services read it to verify your identity or prevent your emails from going to spam.
so, as we beginners, to this things, let me clear more a bit:
like different between A vs CNAME? and NS vs MX ?
A Record vs. CNAME Record : Both records A and CNAME helps to get ip address but, the way is different
A record: it points a domain name directly to a physical IP address like
example.com to 123.23.24CNAME record: It points a domain name to another domain name like
blog.example.com to example.comso, how CNAME get ip address? if point to another domain name “website main goal is to get ip address to show your website” so, here is how:blog.example.com to example.com to 123.23.24mean blog.example.com requests the IP address from example.com, which then checks and returns its IP address to blog.example.com.
NS Record vs. MX Record : One manages the whole house, while the other just manages the mailbox.
NS Record: It tells the internet who manages all your domain's DNS settings, including A, AAAA, and CNAME records etc, which are all part of NS records, mean NS record is boss here (Holds by Company or Authority.
MX Record: It specifically handles where your emails will go, that it, this MX records also comes under MX record that it.
+------------------+
| Root DNS Servers |
+------------------+
|
| Query for "example.com"
v
+--------------------+
| TLD DNS Servers | (.com, .org, .net)
+--------------------+
|
| NS Record: example.com → ns1.example.com, ns2.example.com
v
+--------------------+
| Authoritative DNS |
| for example.com |
+--------------------+
|
| A / AAAA / MX / CNAME records
v
+-----------+
| Host |
+-----------+
How all DNS records work together for one website?
Let's say we buy the domain ygshjm.dev from Hostinger, so Hostinger is the authoritative source for this domain. Then, I want Cloudflare to manage my domain.
So, we hand over the NS records from Hostinger to Cloudflare. Now, Cloudflare is the authoritative source for this domain at the DNS level.
For example, Cloudflare will provide their NS records like dash.ns.cloudflare.com. Then, we go to Hostinger and change the nameserver from Hostinger (ns1.hostinger.com) to (dash.ns.cloudflare.com) Now, Cloudflare has all the DNS records.
How All records will look like at cloudflare:
| Type | Name | Content | TTL mean (cache) |
| A | ygshjm.dev | 80.30.80.30 | Auto |
| CAA mean Certificate Authority Authorization | ygshjm.dev | 0 issuewild digicert.com | Auto |
| CNAME | blogs | hashnode.network (why hashnode) here? because when you type https://blogs.ygshjm.dev/ it will go to your hashnode blog, meaning subdomain of my domain. | Auto |
| NS | ygshjm.dev | ns2.dns-parking.com | Auto |
| NS | ygshjm.dev | ns1.dns-parking.com | Auto |
Having two name servers, like ns1.dns-parking.com and ns2.dns-parking.com, is crucial for redundancy, it just like a backup if one server fail another will handle that it.
+---------------------+
| Root Servers |
+---------------------+
|
| Query ygshjm.dev
v
+---------------------+
| TLD Servers | (.dev)
+---------------------+
|
| NS Records: ns1.dns-parking.com, ns2.dns-parking.com
v
+-----------------------------+
| Authoritative DNS for ygshjm.dev |
+-----------------------------+
| A → 80.30.80.30 | ← Main website IP
| CAA → 0 issuewild digicert.com | ← SSL certificate authorization
| NS → ns1.dns-parking.com, ns2.dns-parking.com |
| CNAME → blogs → hashnode.network | ← Blog subdomain pointing to external host
+-----------------------------+
|
+---------------------+---------------------+
| |
ygshjm.dev (website) blogs.ygshjm.dev (blog)
| |
80.30.80.30 hashnode.network
(your web server IP) (external blog hosting service)
DNS, often seen as "internet voodoo," is an organized system that directs traffic to the correct numbers (A/AAAA), names (CNAME), and mailboxes (MX) to ensure you reach your intended destination when you click "Enter" at browser.




