Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
4 min read

How does a browser know where a website lives?

Let me start with a simple question.

When you type google.com into your browser and press Enter…

How does your computer know where that website actually is?

Your browser doesn’t understand names like google.com.

It only understands numbers i.e IP addresses , like:

 142.250.182.14

So something in the middle has to translate:
website name → server address


DNS in plain English

DNS is basically the phonebook of the internet.

Think about your phone:

You tap on “Mom”
Your phone looks it up
Finds her actual number
And makes the call

DNS works the same way.

You type a domain name.
DNS looks it up.
Returns the IP address.
Your browser connects.


Why do DNS records exist?

A website needs answers to more than just one question.

Not only:

  • Where is this website?

But also:

  • Who manages this domain?

  • Where should emails go?

  • Is this domain verified?

  • Does it support IPv6?

Each of these questions is answered by a different DNS record.

That’s why DNS has multiple record types.


NS Record — Who controls this domain?

Imagine sending a letter.

Before delivery even starts, the post office needs to know:

Which local office handles this area?

That’s exactly what NS records do.

They say:

“These name servers are responsible for this domain.”

If NS records don’t exist, DNS has no idea where to ask anything else.

So NS is always step one.

Simple version:

NS record = domain manager


A Record — Domain → IPv4 address

Once DNS knows who manages your domain, it asks:

“Okay… where is the website?”

The A record answers that.

Example:

example.com → 93.184.216.34

That number is your web server.

Think of it like this:

Domain name = house name
IP address = house number

A record connects the two.


AAAA Record — Same thing, newer internet

AAAA records do the exact same job as A records.

The only difference?

  • A record → IPv4

  • AAAA record → IPv6

IPv6 exists because the internet ran out of old IP addresses.

Not every site uses AAAA yet, but many modern setups do.

No stress if you don’t — it’s optional for most beginners.


CNAME Record — One name pointing to another

Sometimes you don’t want multiple IP addresses.

Instead, you want one name to follow another.

Example:

www.example.com → example.com

That’s a CNAME.

It means:

“Hey DNS, don’t resolve me. Resolve that other domain instead.”

So DNS first looks up example.com, then gets the IP.

Important beginner clarity (A vs CNAME)

  • A record points to an IP

  • CNAME points to another domain

That’s it.

Also: you can’t use both on the same hostname.


MX Record — How email finds you

Web traffic and email are separate systems.

MX records tell the world:

“If someone sends mail to this domain, deliver it here.”

Example:

example.com → mail.example.com

Every email server checks MX records before sending mail.

Common confusion cleared

  • NS decides DNS ownership

  • MX decides email delivery

Different jobs. Totally unrelated.


TXT Record — Notes attached to your domain

TXT records store plain text.

They’re used for things like:

  • Domain verification

  • Email protection (SPF, DKIM, DMARC)

  • Proving ownership to services

I like to think of TXT records as:

sticky notes on your domain.

They don’t control traffic — they just provide information.


How all DNS records work together

A basic website usually has:

  • NS → DNS provider

  • A / AAAA → web server

  • CNAME → www alias

  • MX → mail server

  • TXT → verification + security

Each record solves one small problem.

Together, they make everything work:

Website loads
Emails arrive
Domain stays trusted

No single record does it all.


Browser → DNS → Server (big picture)

https://farm3.static.flickr.com/2435/3607857746_b4372ba3ba_o.png

https://miro.medium.com/0%2AJRojhE3Qh03aza1p.png

4


A / AAAA mapping domain to IP

https://library.mosse-institute.com/_images/dns.png


CNAME aliasing

https://www.techtarget.com/rms/onlineimages/cname_dns_record_request_sequence-f_mobile.png

https://www.tecracer.com/blog/img/2022/02/r53_cname_alias.png

https://global.discourse-cdn.com/cloudflare/original/3X/0/1/01d337180e777fa8c216b07a762a669b88ae56ce.jpeg


MX email routing

https://images.ctfassets.net/aoyx73g9h2pg/3VzrRaM5aobH71Zzy9QUDA/c75752c807f193c7ddabd1ffa5f39d27/MX-record-DNS-Diagram.jpg

https://cdn.prod.website-files.com/644fc991ce69ff211edbeb95/6784e2f1ada454ed0dee61b5_6784df6df41a3ae516b22e52_image3.png

https://www.techfry.com/images/webmaster/mx-record-working.jpg


DNS hierarchy with NS

https://media2.dev.to/dynamic/image/width%3D800%2Cheight%3D%2Cfit%3Dscale-down%2Cgravity%3Dauto%2Cformat%3Dauto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy30ejavshxvip93iw0vy.png


Complete DNS setup example

https://media2.dev.to/dynamic/image/width%3D800%2Cheight%3D%2Cfit%3Dscale-down%2Cgravity%3Dauto%2Cformat%3Dauto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffb2w6unkazqdxdvfm98f.jpeg