Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained:

Published
5 min read
DNS Record Types Explained:
S
2nd year CSE student. MERN Stack Developer. Building scalable web apps and documenting the journey." (Keep it energetic and focused on pure software engineering—no need for the typical "fueled by caffeine" developer cliches, staying hydrated and focused works best!)

Have you ever wondered how your browser knows exactly where a website lives? When you type google.com, your computer doesn't actually know what that is. Computers talk in numbers (IP addresses), but humans talk in names.

DNS (Domain Name System) is the "Phonebook of the Internet." It translates the names we love into the numbers computers need. But a phonebook doesn't just have names; it has different types of entries. In the world of websites, we call these DNS Records.

Why do we need different records?

Imagine if a phonebook only gave you a home address. That’s fine for visiting, but what if you wanted to send a letter? Or find out who owns the house? You’d need different types of info. That’s exactly what DNS records do.

Diagram titled "The High-Level Flow" showing how DNS works: 1. You ask for a name with a person at a laptop saying "mysite.com." 2. DNS gives the number, represented by a DNS Phonebook. 3. You connect to the server, illustrated by a web server icon.


1. The NS Record (The Manager)

Problem: Who is in charge of this domain? The NS (Name Server) Record tells the internet which server is the "boss" of your domain's settings.

  • Real-life example: If a domain is a store, the NS record tells you which office holds the keys and the blueprints.

    Flowchart illustrating the process of finding NS records on the internet, beginning with "The Root," followed by "The TLD Servers" (.com, .co, .in), "The Authoritative Name Servers" (ns1.hover.com, ns2.hover.com), and ending with "The Final Destination" (a website server).

2. The A Record (The GPS)

Problem: I have a name, give me the IPv4 address. This is the most common record. It maps a domain name directly to an IPv4 address (e.g., 192.168.1.1).

  • Real-life example: You search for "Pizza Hut" and the phonebook gives you the physical street address.

    Diagram showing an "A Record" DNS process, where a URL "https://www.google.com" is converted to the IPv4 address "142.250.190.46" pointing to a server icon.

3. The AAAA Record (The Future GPS)

Problem: I need the modern, long-form IPv6 address. It does exactly what the A record does, but for IPv6 (the newer, longer version of IP addresses).

Diagram explaining how A and AAAA records work for DNS. It shows a website URL leading to either an A Record with an IPv4 address, represented by a phone, or an AAAA Record with an IPv6 address, shown as a rocket. Both address types connect to a web server. The A Record uses a 32-bit address, while the AAAA Record uses a 128-bit address, providing more possibilities.

4. The CNAME Record (The Alias)

Problem: I want two names to point to the same place. CNAME (Canonical Name) points one domain name to another name, not an IP.

  • Real-life example: You have a friend named "Robert," but everyone calls him "Bob." In your phonebook, under "Bob," it says "See Robert."

  • Beginner Tip: A CNAME is just a nickname for an existing A record.

5. The MX Record (The Post Office)

Problem: Where should I send emails for this domain? MX (Mail Exchanger) records tell the internet which mail server handles the emails.

  • Real-life example: You want to send a letter to an office, but the letter needs to go to their specific PO Box, not the front door.

    Diagram illustrating email routing via MX records. An email to hello@mysite.com is sent to a DNS server, which directs it using an MX record to a Gmail/mail server. Caption: "MX Records: Directing mail to the post office, not the house."

6. The TXT Record (The Note Pad)

Problem: I need to prove I own this site or provide extra info. TXT records are just text notes attached to your domain. They are often used to verify that you own the domain (like when setting up Google Search Console).

  • Real-life example: Like a "Certified" stamp on a document to prove it's real.

7. How all DNS records work together for one website

Putting it All Together: The "Dream Team" in Action

A single website doesn’t just use one record; it uses a whole "team" of them to function properly. Let’s look at a real-world setup for a student project, like myportfolio.com:

  1. The NS Record points to where your DNS is hosted (like Vercel, Cloudflare, or GoDaddy). It's the Manager saying, "I have the instructions!"

  2. The A Record points myportfolio.com to the server where your HTML/CSS files live. This is the GPS for your visitors.

  3. The CNAME Record makes sure that if someone types www.myportfolio.com (with the www), they get sent to the same place as the main site. It’s the Nickname.

  4. The MX Record ensures that if a recruiter emails you at contact@myportfolio.com, it actually lands in your Gmail inbox. This is your Postal Service.

  5. The TXT Record sits in the background, proving to Google or GitHub that you are the rightful owner of this domain. This is your ID Card.

Without this "team," your website might load, but you wouldn't be able to receive emails. Or your email might work, but the www version of your site would show an error.

Diagram titled "The DNS Team: How One Domain Uses Multiple Records" showing how a domain, "myportfolio.com," utilizes different DNS records. It includes:1. A Record: Directs to an IP address, 76.76.21.21, indicating the server location.2. MX Record: Directs emails to "mail.google.com."3. TXT Record: Shows a verification note for ownership and spam prevention.4. CNAME Record: Ensures redirects from "www.myportfolio.com" to the main site.

More from this blog