Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained: The Complete Beginner's Guide

Updated
7 min read
DNS Record Types Explained: The Complete Beginner's Guide

Ever wondered what happens when you type "google.com" in your browser? How does your computer know where to find Google's website?

The answer is DNS – and more specifically, DNS records.

Honestly, when I first heard about DNS records, I thought it was some super technical thing only network engineers needed to know. But once I understood it, I realized it's actually pretty simple.

Let me break it down for you in the easiest way possible.


What Even is DNS?

DNS stands for Domain Name System.

Think of it like the phonebook of the internet.

When you type "amazon.com" in your browser, your computer doesn't actually understand that. Computers speak in IP addresses – long numbers like 192.168.1.1.

DNS is the system that translates human-friendly names (like amazon.com) into computer-friendly IP addresses.

Without DNS, you'd have to remember random numbers for every website. Imagine typing 142.250.182.206 instead of "google.com" every time!


Why Do DNS Records Exist?

Okay, so DNS translates names to IPs. But here's the thing:

DNS doesn't just store one piece of information.

It stores different types of information for different purposes.

For example:

  • Where is the website hosted?

  • Where should emails go?

  • Who controls this domain?

Each type of information is stored in a DNS record.

So DNS records are just instructions that tell the internet:

  • Where to send website traffic

  • Where to deliver emails

  • Who manages the domain

Let's look at the most important DNS record types one by one.


1. A Record – The Address of Your Website

What is it?

An A Record (Address Record) maps a domain name to an IP address.

This is the most basic and most common DNS record.

Example

Let's say you own the domain blog.thitainfo.com.

You want people to visit your website, which is hosted on a server with IP address 203.0.113.10.

You create an A Record like this:

blog.thitainfo.com → 203.0.113.10

Now, when someone types blog.thitainfo.com in their browser, DNS says:

"Go to 203.0.113.10"

And boom – your website loads.

Real-World Use

Every website you visit uses an A Record.

When you go to facebook.com, DNS checks the A Record and finds Facebook's server IP address. Then your browser connects to that IP.

Simple, right?


2. CNAME Record – The Nickname for Your Domain

What is it?

A CNAME Record (Canonical Name Record) creates an alias for a domain.

Instead of pointing to an IP address, it points to another domain name.

Why use it?

Sometimes you want multiple domain names to point to the same place.

Instead of creating separate A Records for each, you use CNAME.

Example

Let's say you have:

  • Main website: thitainfo.com

  • Blog: blog.thitainfo.com

You want both to point to the same server.

Instead of adding two A Records, you do this:

thitainfo.com → 203.0.113.10 (A Record)
blog.thitainfo.com → thitainfo.com (CNAME)

Now, blog.thitainfo.com just follows wherever thitainfo.com goes.

If you change the IP address of thitainfo.com, the blog automatically updates too.

A vs CNAME – What's the Difference?

Here's where people get confused:

  • A Record = Points to an IP address

  • CNAME Record = Points to another domain name

Think of it like this:

  • A Record is like giving someone your home address.

  • CNAME is like saying, "Go wherever Saurabh goes."


3. MX Record – How Email Gets Delivered

What is it?

An MX Record (Mail Exchange Record) tells the internet where to send emails for your domain.

Example

Let's say your email is contact@thitainfo.com.

When someone sends you an email, their email server asks:

"Where should I deliver emails for thitainfo.com?"

DNS looks at the MX Record and says:

thitainfo.com → mail.thitainfo.com (Priority: 10)

The email server then sends the email to mail.thitainfo.com.

Priority Numbers

MX Records have priority numbers.

Lower numbers = higher priority.

Example:

thitainfo.com → mail1.thitainfo.com (Priority: 10)
thitainfo.com → mail2.thitainfo.com (Priority: 20)

The email server tries mail1 first. If it's down, it tries mail2.

This is called email failover.

Real-World Use

If you use Gmail for your business emails, you add Google's MX Records to your domain.

Something like:

thitainfo.com → aspmx.l.google.com (Priority: 1)

Now all your emails go through Gmail's servers.


4. NS Record – Who Controls Your Domain?

What is it?

An NS Record (Name Server Record) tells the internet which DNS server is responsible for your domain.

Think of it as the boss of your domain's DNS.

Example

Let's say you bought thitainfo.com from GoDaddy.

GoDaddy's name servers are:

ns1.godaddy.com
ns2.godaddy.com

Your NS Records look like this:

thitainfo.com → ns1.godaddy.com
thitainfo.com → ns2.godaddy.com

This means GoDaddy controls the DNS for your domain.

If you want to change your A Record or MX Record, you do it in GoDaddy's dashboard.

Changing Name Servers

Let's say you move your website to AWS.

You can change your NS Records to:

thitainfo.com → ns-123.awsdns-12.com

Now AWS controls your DNS.

NS vs MX – What's the Difference?

  • NS Record = Who manages the domain?

  • MX Record = Where do emails go?

Totally different things.


How Do These Records Work Together?

Here's a real-world example:

Let's say you run blog.thitainfo.com

You set up:

  1. A Record – Points blog.thitainfo.com to your web server IP

  2. CNAME Record – Points www.blog.thitainfo.com to blog.thitainfo.com

  3. MX Record – Points emails to Gmail's servers

  4. NS Record – Says Cloudflare manages your DNS

So when someone:

  • Visits blog.thitainfo.com → DNS uses the A Record to find your server

  • Visits www.blog.thitainfo.com → DNS uses the CNAME to redirect to blog.thitainfo.com

  • Sends an email to contact@thitainfo.com → DNS uses the MX Record to route to Gmail

  • Needs to check DNS settings → DNS checks the NS Record to see Cloudflare controls it

See how they all work together?

Each record type has a specific job.


Quick Recap

Here's a simple summary:

Record TypeWhat It DoesExample
A RecordMaps domain to IP addressblog.thitainfo.com → 203.0.113.10
CNAME RecordCreates an aliaswww.blog.thitainfo.com → blog.thitainfo.com
MX RecordRoutes emailsthitainfo.com → mail.google.com
NS RecordDefines who controls DNSthitainfo.com → ns1.cloudflare.com

Common Mistakes to Avoid

Mistake 1: Using CNAME for the root domain

You cannot use a CNAME for the main domain.

❌ Wrong:

thitainfo.com → someotherdomain.com (CNAME)

✅ Correct:

thitainfo.com → 203.0.113.10 (A Record)
www.thitainfo.com → thitainfo.com (CNAME)

Mistake 2: Forgetting MX Records

If you set up a custom domain for email but forget MX Records, emails won't work.

Always add MX Records when using email with your domain.

Mistake 3: Wrong NS Records

If you change hosting but don't update NS Records, your website won't load.

Always check where your NS Records are pointing.


Why This Matters for Developers

As a developer, understanding DNS is super important.

Here's why:

  • When you deploy a website, you set up A Records.

  • When you add a subdomain (like api.thitainfo.com), you use CNAME or A Records.

  • When you set up email, you configure MX Records.

  • When you switch hosting providers, you update NS Records.

You'll deal with DNS records in every real project.

Honestly, I didn't pay much attention to DNS early in my career. But once I started deploying production systems, I realized how critical it is.


Final Thoughts

DNS might sound boring or technical at first.

But once you get it, it's actually pretty cool.

It's like the hidden system that makes the entire internet work smoothly.

And now you know the four main DNS record types:

  • A Record – Website address

  • CNAME Record – Domain alias

  • MX Record – Email routing

  • NS Record – DNS control

Next time you deploy a website or set up email, you'll know exactly what to do.

Have you ever faced DNS issues? Let me know in the comments!


About the Author

Hi, I'm Saurabh Prajapati – a Full-Stack Software Engineer from India, currently working at IBM India Software Lab on enterprise-level cloud solutions.

I specialize in React, GenAI, and Modern Web Technologies, and I love breaking down complex topics into simple, easy-to-understand content.

📧 Email: saurabhprajapati120@gmail.com
🔗 GitHub: prajapatisaurabh
🔗 LinkedIn: saurabh-prajapati