# DNS Record Types Explained

### *How does a browser know where a website lives?*

When you type **www.YouTube.com** into your browser and hit Enter, your laptop doesn’t know where YouTube is. It needs help.  
That help comes from something called **DNS**.

So in this Blog i will try to explain what is actually a DNS and what are its types.

![The DNS Lookup Journey. …Or one answer to the famous “what… | by ...](https://miro.medium.com/1%2A-kCFoSB3-pMwajK6LTJY6Q.jpeg align="left")

---

## 1\. What is DNS

DNS (Domain Name System) is often called **the internet’s phonebook**.

* We Humans remember names like [`google.com`](http://google.com)
    
* [But Com](http://google.com/)puters communicate using IP addresses like `142.250.182.1`[`4`](http://google.com/)
    

[DNS e](http://google.com/)xists to **map domain names to IP ad**[**dresses** so](http://google.com/) that humans don’t have to remember numbers. Without DNS, [we would n](http://google.com/)eed to type IP addresses directly into browsers, which is impractical and error-prone.

---

## 2\. Why DNS records are needed

DNS alone isn’t enough.  
DNS needs **records** to answer different questions, such as:

* Who manages this domain?
    
* Where is the website hosted?
    
* Where should emails be delivered?
    
* Is this domain verified?
    

Each DNS record solves **one specific problem**

---

## 3\. What is an NS Record

**NS = Name Server**

A nameserver is a type of DNS server. It is the server that stores all DNS records for a domain, including [A records](https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/), [MX recor](https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/)[ds](https://www.cloudflare.com/learning/dns/dns-records/dns-mx-record/), [or CNAME](https://www.cloudflare.com/learning/dns/dns-records/dns-mx-record/) records.

An NS record answers this question:

*“Who is responsible for this domain?”*

NS records tell the internet **which DNS server is the authority** for a domain.

![SDC#24 - How DNS Works? - by Saurabh Dashora](https://substackcdn.com/image/fetch/%24s_%21_iP7%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a5ed500-6b67-4b36-b6fc-fe04d8b02914_2876x1697.png align="left")

---

## 4\. What is an A Record

**A = Address**

It indicates the [IP address](https://www.cloudflare.com/learning/dns/glossary/what-is-my-ip-address/) o[f a given](https://www.cloudflare.com/learning/dns/glossary/what-is-my-ip-address/) [domain](https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/).

[An A](https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/) record answers:

*“Where is the website located”*

When someone types your domain name, the browser asks:

> “Give me the IP address”

And the A record replies with the exact location.

\*A records only hold IPv4 addresses.

---

## 5\. What is an AAAA Record

AAAA record does the **same job as A record**, but for **IPv6**.

* A → IPv4 (older, shorter)
    
* AAAA → IPv6 (newer, longer
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769017864880/9547731e-03e5-4f04-90c1-11821d8122ec.png align="center")
    

## 6\. What is a CNAME Record

**CNAME = Canonical Name**

A CNAME record is used in lieu(instead) of an [A record](https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/), [when a](https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/) [domain](https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/) [or sub](https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/)domain is an alias of another domain. All CNAME records must point to a domain, never to an [IP address](https://www.cloudflare.com/learning/dns/glossary/what-is-my-ip-address/).

[A CNAME](https://www.cloudflare.com/learning/dns/glossary/what-is-my-ip-address/) answers:

*“This name is just another name for that domain.”*

![How ALIAS records can reduce initial load times for your website ...](https://www.tecracer.com/blog/img/2022/02/r53_cname_alias.png align="left")

### A vs CNAME :

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769018099691/c0a20fc2-0f34-40b4-b866-db2234aa13aa.png align="center")

---

## 7\. What is an MX Record

**MX = Mail Exchange**

A DNS 'mail exchange' (MX) record directs email [to a](https://www.cloudflare.com/learning/email-security/what-is-email/) mail server. The MX record indicates how [email](https://www.cloudflare.com/learning/email-security/what-is-email/) messages should be routed in accordance with the Simple Mail Transfer Protocol ([SMTP](https://www.cloudflare.com/learning/email-security/what-is-smtp/), [the](https://www.cloudflare.com/learning/email-security/what-is-smtp/) standard protocol for all email).

MX records answer:

*“Where should emails for this domain go?”*

![What Is a DNS MX Record? | How Email Communication Works | Gcore](https://assets.gcore.pro/site-media/uploads-staging/dns_mx_record_explained_1_f3b4de8869.png align="left")

### NS vs MX :

* **NS** → who controls the domain
    
* **MX** → who handles emails
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769018215481/66ecb123-db46-46e8-90f2-27e9cfeb9192.png align="center")

---

## 8\. What is a TXT Record

The DNS ‘text’ (TXT) record lets a [domain](https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/) [admini](https://www.cloudflare.com/learning/dns/glossary/what-is-a-domain-name/)strator enter text into the [Domain Name System (DNS)](https://www.cloudflare.com/learning/dns/what-is-dns/). [Text is stored in the f](https://www.cloudflare.com/learning/dns/what-is-dns/)orm of one or more strings within quotation marks.

TXT records store **text information**.

They are used for:

* Domain ownership verification
    
* Email security (SPF, DKIM)
    
* Connecting services like Google, GitHub, etc.
    

---

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

Let’s imagine a domain: **YouTube.com**

Here’s what happens:

1. **NS record**  
    → Tells which DNS server is responsible
    
2. **A / AAAA record**  
    → Tells where the website lives
    
3. **CNAME record**  
    → Handles aliases like www
    
4. **MX record**  
    → Routes emails correctly
    
5. **TXT record**  
    → Verifies domain and secures emails
    
    ![The DNS Query Journey: How Your Browser Finds a Website | by Amil ...](https://miro.medium.com/v2/resize%3Afit%3A2000/1%2A2jSLhvLMv9qjf1fhPucSSg.png align="left")
    
    ## <mark>Conclusion :</mark>  
    A single domain doesn’t rely on one record.  
    It uses **multiple DNS records together**, like a team.
