# DNS Record Types

## TL;DR

> **DNS (Domain Name System)** translates human-readable domain names into IP addresses so computers can locate servers.  
> DNS Record Types
> 
> * **NS records** say **who is in charge** of a domain’s DNS (which name servers hold the answers).
>     
> * **A records** map a domain to an **IPv4 address** (exact server location).
>     
> * **AAAA records** do the same for **IPv6 addresses**.
>     
> * **CNAME records** create **aliases**, pointing one domain name to another (e.g., [`www.google.com`](http://www.google.com) `→` [`google.com`](http://google.com)).
>     
> * **MX records** tell the internet **where to deliver emails** and in what priority.
>     
> * **TXT records** store **verification and security rules** (SPF, DKIM, DMARC).
>     
> 
> All DNS records **work together** so websites load correctly, emails arrive, and security checks pass.

---

Have you ever wondered how typing a website name like [*google.com*](http://google.com) takes you to the right place in seconds? This simple action is powered by something called **DNS records**. DNS records are like instructions for the internet, telling it where websites are hosted, how emails should be delivered, and which servers handle different services. Before DNS records, managing these connections was slow and manual. Today, they quietly work behind the scenes, making the internet fast, reliable, and easy to use. Understanding DNS records is an important step in learning how the internet really works.

## What is DNS?

### Domain Name System(DNS)

DNS is the internet's phonebook. It translates human-readable website names into numerical, machine-readable IP addresses (like 192.168.1.1) that computers use to communicate over the internet. When you type a web address like [www.facebook.com](http://www.facebook.com) into your browser, DNS finds the matching IP address so your device can connect to the correct server. In simpler terms, you can think of DNS as asking, “**Whom to talk to next?**”

---

## Why are DNS records needed?

DNS records are needed because they **tell the internet how to find and handle your domain**. Without DNS records, a domain name would be just a label with no direction on where to go or what to do.

It:

* Convert domain names to IP addresses
    
* Route traffic to the correct services
    
* Enable email delivery
    
* Support load balancing & high availability
    
* Improve security
    

> In short, **<mark>DNS records are needed to connect domain names to real internet services securely, reliably, and efficiently.</mark>**

---

## DNS Record Types

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769351680515/9cf63702-68d1-4760-b832-f982fb07d297.png align="center")

DNS record types define **what a domain does and where it points**. Each record type has a specific role, helping the internet know how to **handle websites**, **emails**, and other services.

Types:

* **NS Record (Name Server)**
    
* **A Record (Address Record)**
    
* **AAAA Record**
    
* **CNAME Record (Canonical Name)**
    
* **MX Record (Mail Exchange)**
    
* **TXT Record and many more..**
    

> **Tip**: <mark>Think of DNS records as </mark> **<mark>labels and instructions</mark>** <mark>that guide internet traffic. Each record type plays a specific role to ensure websites load, emails arrive, and services run smoothly.</mark>

---

## NS Record (Name Server Record)

An **NS Record** tells the internet **which DNS servers are responsible for a domain**. In simple terms, it answers the question:

> ***“Who is in charge of this domain’s DNS records?”***

### What does an NS Record do?

* Points a domain to its **<mark>authoritative name servers</mark>**
    
* Tells browsers and systems **<mark>where to ask</mark>** for DNS information
    

### Why is the NS Record important?

Without NS records:

* The domain would not work
    
* Other DNS records (A, MX, CNAME, etc.) would never be found
    
* Websites and emails would fail to load or deliver
    

### Example of an NS Record

```bash
ns1.dnsprovider.com
ns2.dnsprovider.com
```

### Key Points to Remember

* Every domain **<mark>must have NS records</mark>**
    
* Usually there are **<mark>at least two</mark>** for reliability
    
* Changing NS records means **<mark>changing the DNS provider</mark>**
    
* DNS changes may take time to update due to **<mark>DNS propagation</mark>**
    

> **Tip:** An NS Record tells the internet where to find a domain’s DNS information.

> **Simple Analogy**
> 
> Think of <mark>NS records as </mark> **<mark>reception desks</mark>** <mark>for a company</mark>. If someone wants information about a department (like a website or email), the receptionist (NS record) directs them where to go.

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769350482064/55480597-19f7-4ee9-94ab-ae1200436c20.png align="center")

## **A Record (Address Record)**

An **A Record** connects a **domain name to an IPv4 address**. It tells the internet **where a website is hosted**.

In simple words, it answers this question:

> *“Which exact address should I go to for this website?”*

### What does an A Record do?

* Maps a domain or subdomain to a **server’s IP address**
    
* Allows browsers to load websites
    
* Is one of the **most important DNS records**
    

### Example of an A Record

```bash
example.com → 192.0.2.1
```

### Key Points to Remember for an **A Record**

* An **A Record maps a <mark>domain name to an IPv4 address</mark>**
    
* Browsers rely on it to know **<mark>where to send traffic</mark>**
    
* One domain can have **<mark>multiple A records</mark>** (for load balancing)
    
* Without an A record, a website **<mark>cannot be accessed</mark>**
    

> **Tip**: **An A Record is the exact address that tells the internet where a website lives.**

> **Simple Analogy**
> 
> Think of an **<mark>A Record</mark>** <mark>as a </mark> **<mark>home's exact street address</mark>**. If someone wants to visit you, just knowing your name isn't enough—they need your **exact address**. The A Record gives that address, telling the internet exactly **where the website is located**.

## **AAAA Record**

An **AAAA Record** (pronounced *“quad-A”*) links a **domain name to an IPv6 address**. It works just like an A Record, but it's used for the **newer version of internet addresses**.

### What does an AAAA Record do?

* Maps a domain or subdomain to an **IPv6 address**
    
* Allows websites to be reached over **IPv6 networks**
    

### Example of an AAAA Record

```bash
example.com → 2001:db8:85a3::8a2e:370:7334
```

### Key Points to Remember

* AAAA records work with **<mark>IPv6</mark>**
    
* A domain can have **<mark>both A and AAAA records</mark>**
    
* Modern networks prefer IPv6 when available
    

> **Tip**: **An AAAA Record tells the internet where a website lives using an IPv6 address.**

> **Simple Analogy**
> 
> Think of an **<mark>AAAA Record</mark>** <mark>as a </mark> **<mark>new international address format</mark>**. If the old address system (IPv4) runs out of space, this new format ensures every house can still have a **unique address**. The AAAA record tells the internet how to reach that house using the new system.

---

## **CNAME Record (Canonical Name)**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769350840748/ea409ce1-b313-4a56-9d19-eb30f5b31eb5.webp align="center")

A **CNAME Record** lets one domain name **point to another domain name** instead of pointing directly to an IP address.

### What problem does it solve?

Managing multiple domains or subdomains can be difficult if each one needs its own IP address.  
A CNAME record solves this by allowing **aliases**, so when the main domain changes, everything updates automatically.

### Example

```bash
www.shoppy.com → shoppy.netlify.app
```

### Key Points to Remember

* Points to **<mark>another domain name</mark>**, not an IP address
    
* Commonly used for **<mark>subdomains</mark>**
    
* Simplifies DNS management
    
* Cannot be used at the **<mark>root domain</mark>**
    
* Follows the target domain’s A or AAAA record
    

> **Tip**: **A CNAME Record creates an alias that points one domain name to another.**

> **Simple Analogy**
> 
> Think of a **<mark>CNAME record</mark>** <mark>as a </mark> **<mark>nickname</mark>**. Instead of giving someone a new home address, you give them another name that points to the same person. Wherever the person goes, the nickname still works.

---

## **MX Record (Mail Exchange)**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769351321541/873e3438-85e6-486f-988c-028f4318f95a.png align="center")

An **MX Record** tells the internet **which mail servers should receive emails for a domain**.

### What problem does it solve?

Without MX records, email systems wouldn’t know **where to deliver messages** sent to addresses like [`user@example.com`](mailto:user@example.com).The MX record solves this by clearly defining the **email destination servers**.

### Example

```bash
example.com → mail.example.com (priority 10)
```

### Key Points to Remember

* Required for **<mark>receiving emails</mark>**
    
* Points to a **<mark>mail server hostname</mark>**, not an IP address
    
* Uses **<mark>priority values</mark>** (lower number = higher priority)
    
* Multiple MX records can exist for **<mark>backup mail servers</mark>**
    
* Works together with TXT records
    

> **Tip**: **An MX Record directs incoming emails to the correct mail servers.**

> **Simple Analogy**
> 
> Think of an **<mark>MX record</mark>** <mark>as a </mark> **<mark>mailroom address</mark>** <mark>in an office building.</mark> Mail sent to the company doesn't go to random desks—it goes to the mailroom first. The MX record tells the internet **which mailroom handles incoming mail**.

---

## **TXT Record**

A **TXT Record** stores **text-based information** in DNS. It is commonly used for **verification, security, and email authentication**.

### What problem does it solve?

The internet needs a way to **prove domain ownership** and **prevent email spam and spoofing**.  
TXT records solve this by allowing domain owners to publish **trusted instructions and verification data**.

### Example

```bash
example.com → "v=spf1 include:_spf.mailprovider.com ~all"
```

### Key Points to Remember

* Stores **<mark>plain text information</mark>**
    
* Helps prevent **<mark>email spoofing</mark>**
    
* Used to **<mark>verify domain ownership</mark>** (Google, Microsoft, etc.)
    
* Does not directly affect website loading
    

> **Tip**: **A TXT Record publishes important instructions and verification details for a domain.**

> **Simple Analogy**
> 
> Think of a **<mark>TXT record</mark>** <mark>as a </mark> **<mark>notice board outside a house</mark>**. It doesn’t tell people where the house is, but it displays important instructions like “Authorized visitors only” or “Verified owner lives here.”

---

## How All DNS Records Work Together for One Website

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769349416557/e7bfb438-f11c-4c0d-94ba-246601fa4ff3.png align="center")

When you type a website (say `google.com`)name into your browser, **multiple DNS records work together behind the scenes** to make sure the website loads correctly and emails are delivered properly.

### Step-by-Step Flow

1. **NS Record – Who is in charge**
    
    * When you type `google.com`, the browser first checks the **NS records**
        
    * These tell the internet which **Google name servers** are authoritative for `google.com`
        
2. **A / AAAA Record – Where the website lives**
    
    * Google’s name servers return **A records (IPv4)** and **AAAA records (IPv6)**
        
    * These point to Google’s web servers that load the website
        
3. **CNAME Record – Aliases (like** [**www.google.com**](http://www.google.com)**)**
    
    * When you visit `www.google.com`
        
    * A **CNAME record** points `www.google.com` to `google.com`
        
    * This keeps DNS management simple
        
4. **MX Record – Email handling**
    
    * Emails sent to `@google.com` are directed using **MX records** to Google’s mail servers
        
5. **TXT Record – Security & verification**
    
    * Website uses **TXT records** for:
        
        * Email security (SPF, DKIM, DMARC)
            
        * Domain verification for services
            

---

## Common Confusion

## A Record vs CNAME Record

| Feature | **A Record** | **CNAME Record** |
| --- | --- | --- |
| What it points to | **IP address** | **Another domain name** |
| Purpose | Finds the **exact server** | Creates an **alias / nickname** |
| Example | [`google.com`](http://google.com) `→ 142.250.190.14` | [`www.google.com`](http://www.google.com) `→` [`google.com`](http://google.com) |
| Used for | Main websites | Subdomains |
| Can be used at root domain? | Yes | Usually No |
| Follows changes automatically? | No | Yes |
| Simple explanation | “This is the exact address” | “Go ask that domain instead” |

> **Simple takeaway**
> 
> * A Record = direct address
>     
> * CNAME = shortcut to another name
>     

## NS Record vs MX Record

| Feature | **NS Record** | **MX Record** |
| --- | --- | --- |
| What it controls | **DNS management** | **Email delivery** |
| Main question it answers | “Who manages this domain?” | “Where should emails go?” |
| Points to | Name servers | Mail servers |
| Used for | Websites, email, all DNS | Email only |
| Required for website? | Yes | No |
| Required for email? | Yes | Yes |
| Example | [`google.com`](http://google.com) `→` [`ns1.google.com`](http://ns1.google.com) | [`google.com`](http://google.com) `→` [`mail.google.com`](http://mail.google.com) |
| Simple explanation | Front desk of the domain | Mailroom of the domain |

> **Simple takeaway**
> 
> * NS Record = who is in charge
>     
> * MX Record = where emails are delivered
>     

---

## Conclusion

DNS might work quietly in the background, but it is **essential to how the internet operates**. Every time a website loads or an email is sent, various DNS records collaborate to ensure everything runs smoothly. From identifying who manages a domain (NS records) to locating the exact server (A/AAAA records), creating shortcuts (CNAME), directing emails (MX), and enforcing security (TXT), each record has a clear and important job.

Understanding DNS records helps you go from just *using* the internet to truly *understanding* it. Whether you're building a website, setting up email, or learning the basics of networking, DNS is a key concept that links everything together.

---

> If you enjoyed this article, check out my other blogs on this profile.
> 
> 🔗 **Connect with me:**  
> [**LinkedIn**](https://linkedin.com/in/rajharsh4618) | [**GitHub**](https://github.com/Harsh-Raj4618) | [**X (Twitter)**](https://x.com/Harsh_Raj4618)
