DNS Records Explained: A, AAAA, CNAME, MX, and More
DNS Records Explained: A, AAAA, CNAME, MX, and More
DNS is the phone book of the internet. Understanding DNS record types is essential for deploying websites, configuring email, and debugging connectivity issues.
How DNS Works
When you visit example.com, your browser asks a DNS resolver to translate that domain into an IP address. The resolver queries authoritative name servers, caches the result, and returns the IP.
Record Types
A Record
Maps a domain to an IPv4 address. The most fundamental record type.
example.com. A 93.184.216.34
AAAA Record
Maps a domain to an IPv6 address.
example.com. AAAA 2606:2800:220:1:248:1893:25c8:1946
CNAME Record
Creates an alias from one domain to another. Cannot coexist with other records at the same name.
www.example.com. CNAME example.com.
MX Record
Directs email to mail servers. Priority number determines preference (lower = higher priority).
example.com. MX 10 mail1.example.com.
example.com. MX 20 mail2.example.com.
TXT Record
Holds arbitrary text. Used for email authentication (SPF, DKIM, DMARC), domain verification, and more.
example.com. TXT "v=spf1 include:_spf.google.com ~all"
NS Record
Delegates a domain to specific name servers.
example.com. NS ns1.cloudflare.com.
SOA Record
Start of Authority — contains zone metadata like serial number, refresh intervals, and the primary name server.
TTL (Time to Live)
Every record has a TTL in seconds. Lower TTL means faster propagation of changes but more DNS queries. Common values: 300 (5 min) for dynamic records, 86400 (1 day) for stable records.
Debugging DNS
Use our DNS Lookup tool to query any record type for any domain. From the command line:
Query A records
dig example.com A
Query all records
dig example.com ANY
Trace the full resolution path
dig +trace example.com
Common Mistakes
CNAME at the apex — you can't put a CNAME on the root domain (example.com). Use an ALIAS/ANAME record if your DNS provider supports it, or use A records. Missing trailing dot — in zone files, domain names without a trailing dot are relative to the zone origin. Always use the trailing dot for absolute names. Forgetting to update TTL before migration — lower TTL to 300 seconds well before a DNS migration so changes propagate quickly.Conclusion
DNS is deceptively simple on the surface but nuanced in practice. Know your record types, understand TTL implications, and use diagnostic tools to verify your configuration.