# DNS Record Types Explained

## 1\. What DNS is (very simple)

* DNS = Domain Name System.
    
* It is like a phonebook for the internet.
    
* You remember names like [`google.com`](http://google.com), but computers need number addresses like `142.250.183.206` (an IP address).
    
* DNS changes a domain name (like a contact name) into an IP address (like a house address).
    

Example:  
You type [`example.com`](http://example.com) in your browser → browser asks DNS → DNS replies with a number address → browser goes to that server.

---

## 2\. Why DNS records are needed

DNS is not just one big answer.  
It has many small pieces of information called **records**.

* Each record type answers a different question.
    
* Example questions:
    
    * “Which server shows the website?”
        
    * “Which server gets emails?”
        
    * “Who manages this domain’s DNS?”
        
    * “Is this email really from this domain?”
        

These answers are stored as DNS records under your domain, like different entries under one contact in your phone.

---

## 3\. NS record – who is responsible

**NS Record** = Name Server record.

* It tells: “These servers are responsible for DNS of this domain.”
    
* They are like the office where the main phonebook for your domain lives.
    
* When the internet wants any DNS info for [`yourdomain.com`](http://yourdomain.com), it first finds the NS records to know which DNS server to ask.
    

Example:  
[`yourdomain.com`](http://yourdomain.com) → NS records say:

* [`ns1.dnsprovider.com`](http://ns1.dnsprovider.com)
    
* [`ns2.dnsprovider.com`](http://ns2.dnsprovider.com)
    

So the world knows: “Ask these name servers for all other records (A, MX, etc.) of this domain.”

Common confusion:

* NS is about “who holds and answers the DNS records.”
    
* MX is about “who receives emails.” (More on MX later.)
    

---

## 4\. A record – domain → IPv4 address

**A Record** (Address record) connects a **domain name** to an **IPv4 address** (a normal-looking IP like `192.168.1.10`).

* Question it answers: “Where is the website server (IPv4)?”
    
* It is like saying: “The house of [`example.com`](http://example.com) is at street number `93.184.216.34`.”
    

Example:  
[`example.com`](http://example.com) → A record → `93.184.216.34`  
So when someone visits [`example.com`](http://example.com), the browser goes to that IPv4 address.

Common confusion (A vs CNAME):

* A = points to a **number address (IP)**.
    
* CNAME = points to **another name**, not directly to an IP.
    

---

## 5\. AAAA record – domain → IPv6 address

**AAAA Record** connects a **domain name** to an **IPv6 address** (a newer, longer IP like `2001:0db8::1`).

* Question it answers: “Where is the website server (IPv6)?”
    
* It is like a second type of house address, but for IPv6.
    
* You can have both A and AAAA records for the same domain, so it works on both IPv4 and IPv6 networks.
    

Example:  
[`example.com`](http://example.com) → AAAA record → `2001:db8::1234`

---

## 6\. CNAME record – one name to another name

**CNAME Record** (Canonical Name) points **one domain name to another domain name**, not to an IP.

* Question it answers: “If someone asks for this name, which other name should they use?”
    
* It is like a contact in your phone: “Call ‘My Work Site’ → actually call ‘[maincompany.com](http://maincompany.com)’.”
    
* The final IP will come from the A/AAAA record of the target name.
    

Example:

* [`www.example.com`](http://www.example.com) → CNAME → [`example.com`](http://example.com)
    
* [`example.com`](http://example.com) has an A record → `93.184.216.34`
    

So the flow is:

[`www.example.com`](http://www.example.com) → (CNAME) → [`example.com`](http://example.com) → (A) → `93.184.216.34`

Common confusion (A vs CNAME):

* Use **A** when you want to point directly to an IP address.
    
* Use **CNAME** when you want this name to follow another name (and use its IPs).
    

---

## 7\. MX record – how email finds your mail server

**MX Record** (Mail eXchanger) tells which server handles **email** for a domain.

* Question it answers: “Where should emails for this domain be delivered?”
    
* It is like telling the post office: “For letters to this domain, send them to this mail center.”
    
* MX records usually point to a **name**, not a raw IP, and that name will have its own A/AAAA record.
    

Example:  
For [`mycompany.com`](http://mycompany.com):

* MX record: `priority 10` [`mail.mycompany.com`](http://mail.mycompany.com)
    
* Then [`mail.mycompany.com`](http://mail.mycompany.com) → A record → `203.0.113.5`
    

When someone sends an email to [`hello@mycompany.com`](mailto:hello@mycompany.com):

1. Email server checks MX for [`mycompany.com`](http://mycompany.com).
    
2. Finds [`mail.mycompany.com`](http://mail.mycompany.com).
    
3. Looks up A/AAAA for [`mail.mycompany.com`](http://mail.mycompany.com).
    
4. Sends the email to that IP address.
    

Common confusion (NS vs MX):

* NS = “Who answers DNS questions for this domain?”
    
* MX = “Who receives emails for this domain?”
    

---

## 8\. TXT record – extra info and verification

**TXT Record** stores **text** information under your domain.

* Question it answers: “What extra info does this domain want to share?”
    
* Often used for:
    
    * Email security (SPF, DKIM, DMARC).
        
    * Domain ownership verification (Google, Microsoft, etc.).
        
    * Other small notes for machines to read.
        

Example uses:

* SPF (which servers can send mail for your domain)
    
    * `v=spf1 include:_`[`spf.google.com`](http://spf.google.com) `~all`
        
* Verification:
    
    * `google-site-verification=some-random-code`
        

These look scary, but think of TXT as sticky notes attached to your domain for other services to read.

---

## 9\. How all DNS records work together for one website

Imagine you have a small website: [`mycoolsite.com`](http://mycoolsite.com) with a blog and email.  
Here is how records might work together:

* **NS records**
    
    * Say: “DNS for [`mycoolsite.com`](http://mycoolsite.com) is handled by [`ns1.dnsprovider.com`](http://ns1.dnsprovider.com) and [`ns2.dnsprovider.com`](http://ns2.dnsprovider.com).”
        
    * These are the main DNS managers.
        
* **A record**
    
    * [`mycoolsite.com`](http://mycoolsite.com) → `203.0.113.10`
        
    * This is your main web server IPv4.
        
* **AAAA record** (optional)
    
    * [`mycoolsite.com`](http://mycoolsite.com) → `2001:db8::10`
        
    * Same website, but via IPv6.
        
* **CNAME record**
    
    * [`www.mycoolsite.com`](http://www.mycoolsite.com) → [`mycoolsite.com`](http://mycoolsite.com)
        
    * So `www` always follows the main domain’s IP.
        
* **MX record**
    
    * [`mycoolsite.com`](http://mycoolsite.com) → `10` [`mail.mycoolsite.com`](http://mail.mycoolsite.com)
        
    * And [`mail.mycoolsite.com`](http://mail.mycoolsite.com) has an A record to your mail server IP.
        
    * This is how emails to [`info@mycoolsite.com`](mailto:info@mycoolsite.com) know where to go.
        
* **TXT records**
    
    * SPF record for sending safe emails.
        
    * Verification records for tools like Google Search Console.
        

High-level flow (simple story):

1. Browser: “I want [`www.mycoolsite.com`](http://www.mycoolsite.com).”
    
2. DNS:
    
    * Sees CNAME: [`www.mycoolsite.com`](http://www.mycoolsite.com) → [`mycoolsite.com`](http://mycoolsite.com).
        
    * Looks at A/AAAA for [`mycoolsite.com`](http://mycoolsite.com) → gets IP.
        
3. Browser goes to that IP and loads the website.
    
4. When someone sends mail to [`hello@mycoolsite.com`](mailto:hello@mycoolsite.com):
    
    * Their mail server checks MX for [`mycoolsite.com`](http://mycoolsite.com) → finds [`mail.mycoolsite.com`](http://mail.mycoolsite.com).
        
    * Then looks up A/AAAA for [`mail.mycoolsite.com`](http://mail.mycoolsite.com) → IP.
        
    * Sends the email there.
        

---

## 10\. Gentle recap in simple words

* DNS is the **phonebook** of the internet.
    
* **NS**: who keeps the phonebook for your domain.
    
* **A**: name → IPv4 address (house number).
    
* **AAAA**: name → IPv6 address (newer house number style).
    
* **CNAME**: name → another name (like a nickname).
    
* **MX**: where emails should be delivered.
    
* **TXT**: extra notes for security and verification.
