Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
4 min readView as Markdown

HOW DOES A BROWSER KNOW WHERE A WEBSITE LIVES?

When you type a website name like:

www.google.com

A simple question is asked in the background:

“Where does this website live on the internet?”

Computers do not understand website names.
They only understand numbers called IP addresses.

That is why DNS exists.


WHAT IS DNS? (VERY SIMPLE EXPLANATION)

DNS stands for Domain Name System.

DNS is the phonebook of the internet.

In real life:
You remember a person’s name.
Your phonebook finds their phone number.
You call the person.

On the internet:
You type a domain name.
DNS finds the IP address.
Your browser connects to the server.

Without DNS, we would have to remember numbers instead of names.


WHY DNS RECORDS ARE NEEDED

DNS records are entries inside the DNS phonebook.

Each record solves one specific problem:
• Where is the website?
• Who controls this domain?
• Where should emails go?
• Is this domain verified?

A single domain uses multiple DNS records, each doing a different job.


WHAT IS AN NS RECORD? (WHO IS RESPONSIBLE FOR A DOMAIN)

NS means Name Server.

An NS record answers this question:

“Who is responsible for this domain?”

Think of it like a post office.

Domain = house
NS record = post office for that house

The NS record tells the internet:
“These servers are allowed to give official answers for this domain.”

Example:
example.com → ns1.hosting.com
example.com → ns2.hosting.com

Only these name servers can manage the DNS records.


WHAT IS AN A RECORD? (DOMAIN → IPv4 ADDRESS)

A record means Address record.

It answers:
“Where is the website located?”

It connects:
Domain name → IPv4 address

Example:
example.com → 93.184.216.34

Think of it like:
Website name = person’s name
IP address = house number

Your browser uses this IP address to reach the server.


WHAT IS AN AAAA RECORD? (DOMAIN → IPv6 ADDRESS)

AAAA record does the same job as an A record,
but it points to an IPv6 address.

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

Why it exists:
IPv4 addresses are limited.
IPv6 provides many more addresses.

Devices that support IPv6 may use AAAA instead of A.


A RECORD VS CNAME (COMMON CONFUSION)

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

They do different jobs.


WHAT IS A CNAME RECORD? (ONE NAME POINTING TO ANOTHER)

CNAME means Canonical Name.

It answers:
“This domain name is just another name for a different domain.”

Example:
www.example.com → example.com

This means:
www.example.com does not have its own IP address.
It follows the IP of example.com.

Real-life example:
Nickname pointing to a real name.
Contact alias pointing to a main contact.


WHAT IS AN MX RECORD? (HOW EMAILS FIND YOUR MAIL SERVER)

MX means Mail Exchange.

MX records answer:
“Where should emails for this domain be delivered?”

Example:
example.com → mail.google.com (priority 10)

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

Mail servers:

  1. Look up the MX record

  2. Find the mail server

  3. Deliver the email

Important:
MX records are only for email.
NS records are not for email.
A records are not for email routing.


WHAT IS A TXT RECORD? (EXTRA INFORMATION AND VERIFICATION)

TXT records store extra text information.

They are used for:
• Domain ownership verification
• Email security (SPF, DKIM, DMARC)
• Trust and validation

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

Think of TXT records like notes or proof documents attached to a domain.


HOW ALL DNS RECORDS WORK TOGETHER FOR ONE WEBSITE

Let’s take example.com.

  1. Browser asks DNS where example.com is

  2. NS record tells which name servers are responsible

  3. A or AAAA record gives the server IP address

  4. CNAME handles aliases like www.example.com

  5. MX record handles email delivery

  6. TXT record verifies and secures the domain

All records work together to make the website and email function properly.


ONE COMPLETE DNS SETUP (SIMPLE VIEW)

example.com
NS → ns1.host.com, ns2.host.com
A → 93.184.216.34
AAAA → IPv6 address
CNAME → www → example.com
MX → mail.google.com
TXT → verification and email security


HIGH-LEVEL FLOW (BROWSER TO SERVER)

Browser

DNS (internet phonebook)

IP Address

Web Server

Website loads