Every DNS Record Type Explained (With Real Examples)
A records, MX, CNAME, TXT, NS, SOA, PTR, SRV, CAA — what does each one do and when do you need it? A practical reference for every DNS record type.
Every DNS Record Type Explained (With Real Examples)
DNS is the internet's phone book — it translates human-readable domain names into the addresses computers need to communicate. But the phone book has many sections, each serving a different purpose. Here's a practical guide to every DNS record type you'll encounter.
A Record — IPv4 Address
The most fundamental DNS record. An A record maps a domain name to an IPv4 address.
Example:
example.com. 3600 IN A 93.184.216.34
When you need it: Any time you want a domain or subdomain to point to a server. Your website, mail server, API endpoint — all need A records.
Key rule: You can have multiple A records for the same name (for load balancing), but you cannot have an A record and a CNAME on the same name.
AAAA Record — IPv6 Address
The IPv6 equivalent of an A record. As IPv6 adoption grows, adding AAAA records alongside A records is good practice.
Example:
example.com. 3600 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
When you need it: When your server has an IPv6 address. Most modern hosting providers support IPv6.
CNAME Record — Canonical Name
A CNAME creates an alias — it points one domain name to another domain name (not an IP address).
Example:
www.example.com. 3600 IN CNAME example.com.
When you need it: Pointing www to your apex domain, or pointing a subdomain to a CDN or hosting provider's hostname.
Critical rule: Never put a CNAME on your apex (root) domain. It conflicts with MX, NS, and SOA records. Use an A record on the apex, and CNAME on subdomains.
MX Record — Mail Exchange
MX records tell the internet which servers handle email for your domain.
Example:
example.com. 3600 IN MX 10 mail.example.com.
The number (10) is the priority — lower numbers are tried first. Having multiple MX records with different priorities provides failover.
When you need it: Any time you want to receive email at your domain. Your email provider (Google Workspace, Microsoft 365, etc.) gives you the exact MX records to add.
Key rule: MX records must point to a hostname, never directly to an IP address.
TXT Record — Text
TXT records store arbitrary text data. They're used for domain verification and email authentication.
Common uses:
- SPF:
v=spf1 include:_spf.google.com ~all - DKIM:
v=DKIM1; k=rsa; p=MIGfMA0... - DMARC:
v=DMARC1; p=none; rua=mailto:... - Domain verification: Proving ownership to Google, AWS, etc.
When you need it: Email authentication (SPF, DKIM, DMARC), domain verification for third-party services, and site verification for search consoles.
NS Record — Nameserver
NS records specify which nameservers are authoritative for your domain — they tell the internet where to go to find all other DNS records for your domain.
Example:
example.com. 172800 IN NS ns1.exampledns.com.
example.com. 172800 IN NS ns2.exampledns.com.
When you need it: NS records are set automatically by your registrar. You change them when switching DNS providers. Always have at least two NS records for redundancy.
SOA Record — Start of Authority
The SOA record contains administrative information about the zone: the primary nameserver, the email of the zone administrator, and timing values for zone transfers.
Example:
example.com. 3600 IN SOA ns1.example.com. admin.example.com. 2024010101 3600 900 604800 300
The numbers are: serial, refresh, retry, expire, and minimum TTL.
When you need it: Every zone has exactly one SOA record, created automatically by your DNS provider. You rarely need to edit it directly.
PTR Record — Pointer (Reverse DNS)
PTR records are the reverse of A records — they map an IP address back to a domain name. Used primarily for mail server verification.
Example:
34.216.184.93.in-addr.arpa. 3600 IN PTR mail.example.com.
When you need it: If you run a mail server, your hosting provider should set a PTR record for your server's IP. Many receiving mail servers reject email from IPs without reverse DNS.
Key rule: PTR records are set by whoever owns the IP block — your hosting provider, not your domain registrar.
SRV Record — Service
SRV records specify the hostname and port for specific services. Used by VoIP, messaging, and game servers.
Example:
_sip._tcp.example.com. 3600 IN SRV 10 20 5060 sip.example.com.
Format: priority weight port target
When you need it: VoIP services (SIP), Microsoft Teams/Skype for Business, XMPP/Jabber, some game servers, and other services that publish their location via DNS.
CAA Record — Certification Authority Authorization
CAA records specify which certificate authorities (CAs) are allowed to issue SSL/TLS certificates for your domain. They prevent unauthorized certificate issuance.
Example:
example.com. 3600 IN CAA 0 issue "letsencrypt.org"
When you need it: When you want to restrict which CAs can issue certificates for your domain — a security best practice. If no CAA records exist, any CA can issue certificates.
Common values:
0 issue "letsencrypt.org"— Let's Encrypt can issue standard certs0 issuewild "letsencrypt.org"— Let's Encrypt can issue wildcard certs0 iodef "mailto:[email protected]"— Send violation reports here
Quick Reference
| Record | Purpose | Points To |
|---|---|---|
| A | IPv4 address | IP address |
| AAAA | IPv6 address | IPv6 address |
| CNAME | Alias | Another hostname |
| MX | Email routing | Mail server hostname |
| TXT | Text data | Arbitrary text |
| NS | Nameservers | Nameserver hostnames |
| SOA | Zone authority | Administrative data |
| PTR | Reverse DNS | Hostname |
| SRV | Service location | Hostname + port |
| CAA | CA authorization | CA domain |
Understanding which record type to use for each situation is the foundation of effective DNS management. When in doubt, look up what records are currently set on a domain that's working correctly — it's often the fastest way to understand what you need.
Explore Topics
Written by
DomainSpy Team
Content creator and writer sharing insights and stories.