# DNS Record Types Explained

DNS or simply Domain name system is a system for managing all internets domain names and their IP addresses , it is like a phonebook of internet where every device looks for others ip address for their domain name.

## How DNS Works :

1. When you type a website name in your browser its called a domain name , but computer dont recognize these domain names , it recognizes numbers and numeric ip address.
    
2. Suppose you type google.com on browser, the request is sent from browser to the DNS server, which finds the ip address from its records for that domain name
    
3. response is sent back to user and we are connected to google.com to ip address given by dns server eg. 142.250.196.110 .
    

## Why DNS records Are needed:

DNS Servers maps domain names to specific IP addresses (eg. A records for IPv4 , AAAA for IPv6) so that we dont have to remember long numbers.

## What an **NS Record** is (who is responsible for a domain):

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769100091054/806f6df3-2434-4e0f-b8e0-03d4750016e2.png align="center")

NS is a record in DNS Server that tells which Authoritative server is responsible for that Domain names TLD

it directes queries to the correct place to find other DNS records (like A, MX, CNAME) for that domain

Reocrds (like A, MX, CNAME) for that domain, ensures websites and services load properly.

It points to the DNS servers that manage a domain's records, acting like a pointer to the right "phone book" for that domain's information.

Multiple NS records can be added (primary and secondary)which provide redundancy for reliability and changing them is necessary when switching hosting providers.

## **Example Structure**

[`example.com`](http://example.com)`. NS` [`ns1.exampleserver.com`](http://ns1.exampleserver.com)`. (TTL 21600) [1, 3]`

[`example.com`](http://example.com)`.`: The domain name.

`NS`: The record type (Name Server).

[`ns1.exampleserver.com`](http://ns1.exampleserver.com)`.`: The authoritative nameserver.

`21600`: Time to Live (TTL) in seconds, how long caches store the record.

1. ## What an **A Record** is (domain → IPv4 address)
    
    An A Record (Address Record) is a fundamental Domain Name System (DNS) record that maps a human-readable domain name (like [`www.example.com`](http://www.example.com)) directly to its corresponding numerical [**IPv4 address**](https://www.google.com/search?q=IPv4+address&sca_esv=591f49c5cb9ac867&sxsrf=ANbL-n4nCCK9Hm-skMhyekAud4gRfoZtMQ%3A1769093635182&ei=AzpyadD1CvSfvr0PhL60kAU&ved=2ahUKEwjs2b_53J-SAxU6afUHHUUWKHAQgK4QegQIARAD&uact=5&oq=What+an+A+Record+is+%28domain+%E2%86%92+IPv4+address%29&gs_lp=Egxnd3Mtd2l6LXNlcnAiLVdoYXQgYW4gQSBSZWNvcmQgaXMgKGRvbWFpbiDihpIgSVB2NCBhZGRyZXNzKTINECMY8AUYJxjJAhjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjINECMY8AUYJxjqAhieBjIHECMYJxjqAjIHECMYJxjqAjIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBAUizqf8BUN6m_wFY3qb_AXACeAGQAQCYAQCgAQCqAQC4AQPIAQD4AQH4AQKYAgKgAheoAhDCAgoQABiwAxjWBBhHwgINEAAYgAQYsAMYQxiKBcICDhAAGLADGOQCGNYE2AEBwgIZEC4YgAQYsAMY0QMYQxjHARjIAxiKBdgBAZgDDvEFXjnZFB1UyFeIBgGQBhG6BgYIARABGAmSBwEyoAcAsgcAuAcAwgcFMi0xLjHIBxCACAA&sclient=gws-wiz-serp), [acting as t](https://www.google.com/search?q=IPv4+address&sca_esv=591f49c5cb9ac867&sxsrf=ANbL-n4nCCK9Hm-skMhyekAud4gRfoZtMQ%3A1769093635182&ei=AzpyadD1CvSfvr0PhL60kAU&ved=2ahUKEwjs2b_53J-SAxU6afUHHUUWKHAQgK4QegQIARAD&uact=5&oq=What+an+A+Record+is+%28domain+%E2%86%92+IPv4+address%29&gs_lp=Egxnd3Mtd2l6LXNlcnAiLVdoYXQgYW4gQSBSZWNvcmQgaXMgKGRvbWFpbiDihpIgSVB2NCBhZGRyZXNzKTINECMY8AUYJxjJAhjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjIHECMYJxjqAjINECMY8AUYJxjqAhieBjIHECMYJxjqAjIHECMYJxjqAjIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBATIWEAAYgAQYQxi0AhjnBhiKBRjqAtgBAUizqf8BUN6m_wFY3qb_AXACeAGQAQCYAQCgAQCqAQC4AQPIAQD4AQH4AQKYAgKgAheoAhDCAgoQABiwAxjWBBhHwgINEAAYgAQYsAMYQxiKBcICDhAAGLADGOQCGNYE2AEBwgIZEC4YgAQYsAMY0QMYQxjHARjIAxiKBdgBAZgDDvEFXjnZFB1UyFeIBgGQBhG6BgYIARABGAmSBwEyoAcAsgcAuAcAwgcFMi0xLjHIBxCACAA&sclient=gws-wiz-serp)he internet's phonebook to find the server hosting a website or service, allowing your browser to connect to the right computer. The "A" stands for Address, distinguishing it from AAAA records (for IPv6) and other types like MX (mail) or CNAME (alias).
    
2. ## What an **AAAA Record** is (domain → IPv6 address)
    
    An AAAA (Quad-A) record is a type of DNS record that maps a human-readable domain name (like [`www.example.com`](http://www.example.com)) to a specific [**IPv6 address**](https://www.google.com/search?q=IPv6+address&sca_esv=591f49c5cb9ac867&sxsrf=ANbL-n6S9W1EUK4w2aqSymemDXUN9OukxQ%3A1769104799947&ei=n2VyaZPJObnnosUPi--I6Qc&ved=2ahUKEwj_0NnR55-SAxUeiK8BHZ3MFTMQgK4QegQIARAB&uact=5&oq=What+an+AAAA+Record+is+%28domain+%E2%86%92+IPv6+address%29%0D%0A%0D%0A&gs_lp=Egxnd3Mtd2l6LXNlcnAiMldoYXQgYW4gQUFBQSBSZWNvcmQgaXMgKGRvbWFpbiDihpIgSVB2NiBhZGRyZXNzKQoKSABQAFgAcAB4AZABAJgBAKABAKoBALgBA8gBAPgBAvgBAZgCAKACAJgDAJIHAKAHALIHALgHAMIHAMgHAIAIAA&sclient=gws-wiz-serp&mstk=AUtExfD7mPiF2wv5QqDF3gJY93Fx03HVjh4P7p5MPjbwkr8VI1ovRtEb_g8TXjkFSzBxYdS9Gtcta7SKb2rLHoctKa3uxg44ZvX-pJJoHawUetCF5xea8hFDGT5UU7CIQSZnts7b45yuAYUEp2SCiiwHO2KhSYIymnvXPFu8n03HVnMsK-U&csui=3), [serving the](https://www.google.com/search?q=IPv6+address&sca_esv=591f49c5cb9ac867&sxsrf=ANbL-n6S9W1EUK4w2aqSymemDXUN9OukxQ%3A1769104799947&ei=n2VyaZPJObnnosUPi--I6Qc&ved=2ahUKEwj_0NnR55-SAxUeiK8BHZ3MFTMQgK4QegQIARAB&uact=5&oq=What+an+AAAA+Record+is+%28domain+%E2%86%92+IPv6+address%29%0D%0A%0D%0A&gs_lp=Egxnd3Mtd2l6LXNlcnAiMldoYXQgYW4gQUFBQSBSZWNvcmQgaXMgKGRvbWFpbiDihpIgSVB2NiBhZGRyZXNzKQoKSABQAFgAcAB4AZABAJgBAKABAKoBALgBA8gBAPgBAvgBAZgCAKACAJgDAJIHAKAHALIHALgHAMIHAMgHAIAIAA&sclient=gws-wiz-serp&mstk=AUtExfD7mPiF2wv5QqDF3gJY93Fx03HVjh4P7p5MPjbwkr8VI1ovRtEb_g8TXjkFSzBxYdS9Gtcta7SKb2rLHoctKa3uxg44ZvX-pJJoHawUetCF5xea8hFDGT5UU7CIQSZnts7b45yuAYUEp2SCiiwHO2KhSYIymnvXPFu8n03HVnMsK-U&csui=3) same function as an A record but for the newer, longer IPv6 format instead of IPv4. It tells your browser the IPv6 location of a website, enabling communication over the IPv6 internet as adoption grows.
    
3. ## What a **CNAME Record** is (one name pointing to another name)
    
    A CNAME (Canonical Name) Record is a [Domain Name System](https://www.google.com/search?q=Domain+Name+System&sca_esv=591f49c5cb9ac867&sxsrf=ANbL-n4wemsuP9k8c2pnOcH3k9Sr4LE3GQ%3A1769107669310&ei=1XByabPYErnL1e8PzIvNsAQ&ved=2ahUKEwiovZSK6J-SAxUwk1YBHUMVN0EQgK4QegQIARAD&uact=5&oq=What+a+CNAME+Record+is+%28one+name+pointing+to+another+name%29.&gs_lp=Egxnd3Mtd2l6LXNlcnAiO1doYXQgYSBDTkFNRSBSZWNvcmQgaXMgKG9uZSBuYW1lIHBvaW50aW5nIHRvIGFub3RoZXIgbmFtZSkuMgUQIRigAUj3HVC_A1i2DHABeAGQAQCYAZIDoAG5BKoBBzAuMS40LTG4AQPIAQD4AQH4AQKYAgOgAuoEqAIQwgIHECMYJxjqAsICDRAjGPAFGCcYyQIY6gLCAhcQABiABBiRAhi0AhjnBhiKBRjqAtgBAcICBRAAGO8FwgIIEAAYgAQYogTCAggQABiiBBiJBZgDIPEF2czqkbr1Qe26BgYIARABGAGSBwcxLjEuNC0xoAf5BLIHBzAuMS40LTG4B8oEwgcJMC4xLjEuMC4xyAcigAgA&sclient=gws-wiz-serp&mstk=AUtExfAMYx8SPL1rh175L3-C5dZ1r6QQDJT9jKzD92vqbaVbPjUz2Rl-iaMUHls7w0Bt7-dG6rLvbDnGnqEKnsm_KjQvR-UqEbs7RI5fEI8gSqAhuXlj_DZOSCEXdcev8eMD-9OHYINdxrQXKYSPtlAF6e6n6I7GOaEZ-fg4LglPDAcXDydHhIstzVCwgyiUbNqkxYsibMDVttpZiGdQy9nE9a0ufZm8R97Cjb7TZthpYLZITX5fhH0RnXLnCczyZfXG6v_Iz9opwLDKlI_nKIA-zL1q2_MqzE6NNH80SfFFz3UQvw&csui=3) [(DNS) record that](https://www.google.com/search?q=Domain+Name+System&sca_esv=591f49c5cb9ac867&sxsrf=ANbL-n4wemsuP9k8c2pnOcH3k9Sr4LE3GQ%3A1769107669310&ei=1XByabPYErnL1e8PzIvNsAQ&ved=2ahUKEwiovZSK6J-SAxUwk1YBHUMVN0EQgK4QegQIARAD&uact=5&oq=What+a+CNAME+Record+is+%28one+name+pointing+to+another+name%29.&gs_lp=Egxnd3Mtd2l6LXNlcnAiO1doYXQgYSBDTkFNRSBSZWNvcmQgaXMgKG9uZSBuYW1lIHBvaW50aW5nIHRvIGFub3RoZXIgbmFtZSkuMgUQIRigAUj3HVC_A1i2DHABeAGQAQCYAZIDoAG5BKoBBzAuMS40LTG4AQPIAQD4AQH4AQKYAgOgAuoEqAIQwgIHECMYJxjqAsICDRAjGPAFGCcYyQIY6gLCAhcQABiABBiRAhi0AhjnBhiKBRjqAtgBAcICBRAAGO8FwgIIEAAYgAQYogTCAggQABiiBBiJBZgDIPEF2czqkbr1Qe26BgYIARABGAGSBwcxLjEuNC0xoAf5BLIHBzAuMS40LTG4B8oEwgcJMC4xLjEuMC4xyAcigAgA&sclient=gws-wiz-serp&mstk=AUtExfAMYx8SPL1rh175L3-C5dZ1r6QQDJT9jKzD92vqbaVbPjUz2Rl-iaMUHls7w0Bt7-dG6rLvbDnGnqEKnsm_KjQvR-UqEbs7RI5fEI8gSqAhuXlj_DZOSCEXdcev8eMD-9OHYINdxrQXKYSPtlAF6e6n6I7GOaEZ-fg4LglPDAcXDydHhIstzVCwgyiUbNqkxYsibMDVttpZiGdQy9nE9a0ufZm8R97Cjb7TZthpYLZITX5fhH0RnXLnCczyZfXG6v_Iz9opwLDKlI_nKIA-zL1q2_MqzE6NNH80SfFFz3UQvw&csui=3) acts as an **alias**, pointing one domain name (like [`blog.example.com`](http://blog.example.com)) to another *canonical* domain name (like [`example.com`](http://example.com)), not directly to an IP address, it says "This name is another name for that name". When someone requests the alias, the DNS resolver follows the CNAME to the target domain, performs another lookup for the target's IP address, and returns it, streamlining management by pointing multiple subdomains to a single service or server.
    
    **WORKING :**
    
    * **User Request:** A user types [`blog.example.com`](http://blog.example.com) into their browser.
        
    * **DNS Lookup:** The DNS resolver finds the CNAME record for [`blog.example.com`](http://blog.example.com).
        
    * **Alias Followed:** The CNAME tells the resolver that [`blog.example.com`](http://blog.example.com) is an alias for [`example.com`](http://example.com) (the canonical name).
        
    * **Second Lookup:** The resolver then looks up the A (or AAAA) record for [`example.com`](http://example.com) to get its IP address.
        
    * **Connection:** The browser connects to the IP address found for [`example.com`](http://example.com)
        
    * **USES :**
        
    * **Subdomains:** you can set up your DNS to direct queries from [`blogs.jayworks.dev`](http://blogs.jayworks.dev) (personal domain ) to [`blogname.hashnode.com`](http://blogname.hashnode.com) using a **CNAME record**.
        
    * **Third-Party Services:** Directing subdomains (eg. [`shop.yourdomain.com`](http://shop.yourdomain.com)) to platforms like Shopify or GitHub Pages (eg. [`your-store.myshopify.com`](http://your-store.myshopify.com)).
        
    * **CDN Integration:** Routing traffic through a Content Delivery Network (CDN) by pointing a subdomain to the CDN's domain.
        
    
4. ## What an **MX Record** is (how emails find your mail server)
    
    An **MX record** is a simple map in the Domain Name System (DNS) that tells email servers exactly where to deliver messages for your domain.
    
    ### **How Emails Find Your Mail Server**
    
    When an email is sent, the following process occurs:
    
    1. **Email Submission**: Your email client (like Outlook or Gmails web interface) sends the email to your email provider's outgoing mail server (a Mail Transfer Agent or MTA).
        
    2. **DNS Query**: The sending MTA performs a DNS query for the recipient's domain name to retrieve its MX records.
        
    3. **MX Record Identification**: The DNS server responds with a list of MX records for that domain. Each record contains a priority value and the **hostname** of a mail server responsible for handling the email.
        
    4. **SMTP Connection**: The sending MTA attempts to connect to the mail server with the **lowest priority number** (highest priority) first.
        
    5. **Email Delivery**: Once a connection is established, the email is transferred via SMTP to the recipient's mail server, where it is placed in the recipient's mailbox to be accessed later by their email client (via IMAP or POP).
        
    
5. ## What a **TXT Record** is (extra information and verification)
    
    A TXT record is a small , customizable note you pin to your domains official record book (DNS).
    
    Its just plain text, but other internet services read these notes to verify that you own the domain or to check your policies.
    

A single domain name (like [`example.com`](http://example.com)) functions much like a single street address for multiple services within a building. Just as a building needs separate suites for a doctor, a lawyer, and an accountant, a single domain uses multiple DNS record types to direct different kinds of network traffic to the correct destination. 

Here’s how different records work together under one domain:

### **The Domain's Directory**

Think of the domain name as the main entrance to a complex. The DNS records are the directory in the lobby, pointing visitors (traffic) to specific suites (servers). 

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769838724755/e008c663-df40-4c7c-87e8-dd1ed50f7049.png align="center")
