Understanding DNS Record Types
DNS (Domain Name System) is the infrastructure that translates domain names into IP addresses and routes email, certificates, and services. Understanding DNS record types is essential for configuring domains, debugging connectivity, setting up email, and deploying web services.
This guide covers every DNS record type you are likely to encounter, with practical examples.
How DNS Works
When you type example.com in a browser, your computer sends a DNS query to a recursive resolver (like Cloudflare 1.1.1.1 or Google 8.8.8.8). The resolver walks the DNS hierarchy — root servers, TLD servers, authoritative servers — to find the answer, then caches it for the TTL (Time To Live) duration.
Each DNS record has four parts:
- Name — the domain or subdomain
- Type — what kind of record (A, MX, TXT, etc.)
- Value — the record data
- TTL — how long resolvers can cache the answer (in seconds)
Address Records
A Record (IPv4 Address)
Maps a domain to an IPv4 address. This is the most fundamental record type.
example.com. 300 IN A 93.184.216.34
Most domains have one or more A records. Multiple A records provide basic round-robin load balancing.
AAAA Record (IPv6 Address)
Maps a domain to an IPv6 address. The "quad-A" name comes from being four times the size of an A record (128 bits vs 32 bits).
example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
Publish both A and AAAA records for dual-stack connectivity.
Mail Records
MX Record (Mail Exchange)
Directs email to the correct mail servers. Each MX record has a priority (lower = preferred) and a mail server hostname.
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
Sending servers try the lowest priority first and fall back to higher priorities.
TXT Record (for SPF, DKIM, DMARC)
TXT records store arbitrary text, but their primary modern use is email authentication:
- SPF:
v=spf1 include:_spf.google.com -all - DKIM: Published at
selector._domainkey.example.com - DMARC: Published at
_dmarc.example.com
TXT records are also used for domain verification (Google, Let's Encrypt), DKIM keys, and other protocols.
Aliasing Records
CNAME Record (Canonical Name)
Creates an alias from one domain to another. The resolver follows the CNAME to find the actual address.
www.example.com. 3600 IN CNAME example.com.
blog.example.com. 3600 IN CNAME hosting.provider.com.
Important rules:
- A CNAME cannot coexist with other record types at the same name (no CNAME + MX at the same subdomain)
- You cannot CNAME a zone apex (
example.comwithout a subdomain) in standard DNS — some providers offer workarounds (ALIAS, ANAME, CNAME flattening)
Delegation Records
NS Record (Name Server)
Delegates a domain or subdomain to specific name servers. Every domain has NS records pointing to its authoritative DNS servers.
example.com. 86400 IN NS ns1.dnshost.com.
example.com. 86400 IN NS ns2.dnshost.com.
SOA Record (Start of Authority)
Contains administrative metadata about the zone: the primary name server, contact email, serial number, and refresh/retry/expire timers.
example.com. 3600 IN SOA ns1.dnshost.com. admin.example.com. 2024010101 3600 900 604800 86400
Every DNS zone has exactly one SOA record.
Security Records
CAA Record (Certificate Authority Authorization)
Specifies which certificate authorities (CAs) are allowed to issue TLS certificates for your domain.
example.com. 3600 IN CAA 0 issue "letsencrypt.org"
example.com. 3600 IN CAA 0 issuewild "letsencrypt.org"
example.com. 3600 IN CAA 0 iodef "mailto:security@example.com"
If no CAA record exists, any CA can issue a certificate. Publishing CAA records prevents unauthorized certificate issuance.
Service Records
SRV Record (Service Locator)
Specifies the host and port for a service. Used by SIP, XMPP, LDAP, and other protocols.
_sip._tcp.example.com. 3600 IN SRV 10 60 5060 sip.example.com.
Format: priority weight port target
PTR Record (Pointer / Reverse DNS)
Maps an IP address back to a domain name. Used for reverse DNS lookups and email server verification.
34.216.184.93.in-addr.arpa. 3600 IN PTR example.com.
Many mail servers reject email from IPs without valid PTR records.
Quick Reference Table
| Type | Purpose | Example value |
|---|---|---|
| A | IPv4 address | 93.184.216.34 |
| AAAA | IPv6 address | 2606:2800:220:1:... |
| MX | Mail server | 10 mail.example.com. |
| CNAME | Alias to another name | example.com. |
| TXT | Text (SPF, DKIM, verification) | v=spf1 include:... |
| NS | Name server delegation | ns1.dnshost.com. |
| SOA | Zone authority metadata | ns1. admin. serial ... |
| CAA | Certificate authority control | 0 issue "letsencrypt.org" |
| SRV | Service host and port | 10 60 5060 sip.example.com. |
| PTR | Reverse DNS | example.com. |
Try It
Look up any DNS record type for any domain with StackCache DNS Lookup. It queries via DNS-over-HTTPS (Cloudflare) and displays results with TTL, DNSSEC status, and full answer details — all from your browser.
Try it yourself
Open the tool mentioned in this guide — it runs locally in your browser, no account needed.
Open tool