@Ajit5ingh

DNS Records Explained

Understanding A, CNAME, MX, TXT, and other DNS record types

What are DNS Records?

DNS records are like entries in a phone book for the internet. When you type "google.com" into your browser, DNS records tell your computer where to actually go - what IP address to connect to, where to send emails, and other important information. Each type of DNS record has a specific job.

šŸ“– Want to learn more? Check out our detailed guide on What Actually Happens When You Type a URL to understand the complete DNS lookup process.

How DNS Lookup Works


sequenceDiagram
    participant User
    participant Browser
    participant DNS
    participant Server
    
    User->>Browser: Types "example.com"
    Browser->>DNS: Where is example.com?
    DNS->>DNS: Checks DNS records
    DNS-->>Browser: IP: 93.184.216.34
    Browser->>Server: Connect to 93.184.216.34
    Server-->>Browser: Website content
    Browser-->>User: Shows website

Common DNS Record Types

A Record (Address)

Points your domain to an IPv4 address. This is the most basic and common DNS record - it tells browsers where your website lives.

example.com A 93.184.216.34

Use it for: Pointing your main domain to your web server.

AAAA Record (IPv6 Address)

Same as A record but for IPv6 addresses. IPv6 is the newer internet addressing system with way more addresses available.

example.com AAAA 2606:2800:220:1:248:1893:25c8:1946

Use it for: Supporting IPv6-enabled devices and future-proofing your site.

CNAME Record (Canonical Name)

Creates an alias that points to another domain name. Like a nickname - when someone uses the alias, DNS automatically redirects them to the real name.

www.example.com CNAME example.com
# alias "www.example.com" points to "example.com"

blog.example.com CNAME myblog.wordpress.com
# alias "blog.example.com" points to "myblog.wordpress.com"

Use it for: Creating subdomains or pointing to external services like CDNs.

MX Record (Mail Exchange)

Tells email services where to deliver mail for your domain. You can have multiple MX records with different priorities - lower numbers get tried first.

example.com MX 10 mail1.example.com
example.com MX 20 mail2.example.com

Use it for: Setting up email for your domain (Gmail, Outlook, etc).

TXT Record (Text)

Stores text information. Commonly used for email verification, domain ownership proof, and security settings. It's like a notes field that other services can read.

example.com TXT "v=spf1 include:_spf.google.com ~all"
example.com TXT "google-site-verification=abc123"

Use it for: Email authentication (SPF, DKIM), domain verification, security policies.

NS Record (Nameserver)

Specifies which nameservers are authoritative for your domain. These are the servers that actually host your DNS records.

example.com NS ns1.cloudflare.com
example.com NS ns2.cloudflare.com

Use it for: Pointing your domain to a DNS hosting provider.

← Back to All Explainers