DNS — the Domain Name System — is often called the phone book of the internet. Type a domain name, and DNS translates it into the IP address your browser needs to connect to the right server. But DNS is far more than just "domain to IP" mapping. A full DNS zone contains dozens of record types, each controlling a different aspect of how your domain behaves: where email goes, which servers are authoritative, how subdomains point elsewhere, and even security verification strings.
This guide explains every major DNS record type in plain English, with real examples, common use cases, and the TTL (Time To Live) considerations you need to know before making changes.
Quick Reference: DNS Record Types
| Record Type | Purpose | Common Use |
|---|---|---|
A | Maps hostname to IPv4 address | Pointing your domain to a server |
AAAA | Maps hostname to IPv6 address | IPv6-enabled servers |
CNAME | Alias one hostname to another | www subdomain, CDN integration |
MX | Directs email to mail servers | Email routing (Gmail, Outlook) |
TXT | Arbitrary text strings | SPF, DKIM, DMARC, domain verification |
NS | Delegates authority to name servers | Pointing to your DNS provider |
SOA | Start of Authority — zone metadata | Auto-generated, rarely edited manually |
PTR | Reverse lookup: IP to hostname | Email reputation, security logging |
SRV | Service location record | SIP, XMPP, Microsoft services |
CAA | Authorized CAs for SSL certificates | Restricting who can issue certs |
DNSKEY | DNSSEC public key | DNSSEC validation |
DS | DNSSEC delegation signer | Chain of trust between zones |
1 A Record — The Foundation
The A record (Address record) is the most fundamental DNS record. It maps a hostname to an IPv4 address. When you type example.com in a browser, the DNS resolver looks up the A record for example.com and gets back something like 93.184.216.34.
Anatomy of an A Record
; Format: hostname TTL class type value
example.com. 3600 IN A 93.184.216.34
www.example.com. 3600 IN A 93.184.216.34
The trailing dot after example.com. denotes the DNS root — it makes the name fully qualified (FQDN). Most DNS management UIs hide this.
Multiple A Records (Round-Robin Load Balancing)
You can have multiple A records for the same hostname. DNS resolvers cycle through them, providing a primitive form of load balancing:
example.com. 60 IN A 203.0.113.10
example.com. 60 IN A 203.0.113.11
example.com. 60 IN A 203.0.113.12
Common A Record Configurations
@(root domain) — points to your primary web server or load balancerwww— often a CNAME to the root, or its own A recordmail— points to your mail server IP (if not handled by MX)dev,staging— point to non-production environments
2 AAAA Record — IPv6
The AAAA record (quad-A) does the same thing as an A record but for IPv6 addresses. IPv6 addresses are 128-bit and written in eight groups of four hexadecimal digits separated by colons.
example.com. 3600 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
Modern servers should have both A and AAAA records. When a client supports IPv6 (most do), it will prefer the AAAA record. IPv6-only or dual-stack servers benefit from this; IPv4-only servers can safely omit it.
Checking AAAA Records
dig AAAA example.com
nslookup -type=AAAA example.com
You can also use the DNS Lookup Tool and select record type AAAA to check any domain instantly.
3 CNAME Record — Aliases
A CNAME record (Canonical Name) creates an alias from one hostname to another. Rather than pointing directly to an IP address, it points to another domain name, which is then resolved normally.
; www.example.com is an alias for example.com
www.example.com. 3600 IN CNAME example.com.
; blog.example.com points to a hosted blogging platform
blog.example.com. 3600 IN CNAME myblog.wordpress.com.
; CDN integration — static assets served from a CDN
static.example.com. 3600 IN CNAME d1234abcd.cloudfront.net.
Critical CNAME Rules
- Never use a CNAME at the root domain (zone apex). You cannot create a CNAME for
example.com— only for subdomains. The root zone must use A or AAAA records. Some DNS providers offer proprietary workarounds like ALIAS or ANAME records for this. - A CNAME cannot coexist with other records for the same name. If
www.example.comhas a CNAME, it cannot also have an MX or TXT record. - CNAME chains work but are inefficient. Each hop adds a DNS lookup. Keep chains short (one or two hops maximum).
When to Use CNAME vs. A Record
| Use A Record When | Use CNAME When |
|---|---|
| You know the exact IP address | You're pointing to a third-party service with a dynamic IP |
| You need maximum performance (one lookup) | You're aliasing subdomains (www, blog, shop) |
| Configuring the root domain | Integrating CDNs, Heroku, GitHub Pages, Netlify, etc. |
4 MX Record — Email Routing
The MX record (Mail Exchanger) tells the world which mail servers should receive email for your domain. When someone sends an email to hello@example.com, the sending mail server queries the MX records for example.com to find out where to deliver the message.
; Format: hostname TTL class type priority mail-server
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
The priority number (also called preference) is critical. Lower numbers have higher priority. If the primary server (10) is unreachable, the sending server falls back to the secondary (20). Equal priorities are used round-robin.
MX Records for Google Workspace
example.com. 3600 IN MX 1 aspmx.l.google.com.
example.com. 3600 IN MX 5 alt1.aspmx.l.google.com.
example.com. 3600 IN MX 5 alt2.aspmx.l.google.com.
example.com. 3600 IN MX 10 alt3.aspmx.l.google.com.
example.com. 3600 IN MX 10 alt4.aspmx.l.google.com.
MX Records for Microsoft 365
example.com. 3600 IN MX 0 example-com.mail.protection.outlook.com.
Important: MX Records Must Point to A Records
The value of an MX record must be a hostname — never an IP address directly, and never a CNAME. The hostname you point to must itself have an A (or AAAA) record resolving to the mail server's IP address.
5 TXT Record — Text and Email Security
The TXT record stores arbitrary text strings in DNS. Originally designed for human-readable notes, TXT records are now the backbone of email authentication, domain verification, and security policy publishing.
SPF — Sender Policy Framework
SPF tells receiving mail servers which IP addresses are authorized to send email on behalf of your domain. Without SPF, spammers can forge your domain in the From header.
; Allow Google Workspace to send for example.com
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"
; Allow Microsoft 365 + a specific IP
example.com. 3600 IN TXT "v=spf1 include:spf.protection.outlook.com ip4:203.0.113.10 ~all"
SPF qualifiers:
+all— pass (allow all — insecure, avoid)~all— softfail (accept but mark as suspicious)-all— fail (reject mail from unauthorized sources)?all— neutral (no policy)
You can only have one SPF record per domain. If you use multiple email providers, combine them into a single TXT record with multiple include: statements.
DKIM — DomainKeys Identified Mail
DKIM adds a cryptographic signature to outgoing emails. The receiving server verifies the signature against the public key stored in your DNS, proving the email wasn't tampered with in transit.
; DKIM records live at a selector._domainkey subdomain
google._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBA..."
Your email provider generates the DKIM key pair and gives you the TXT record value to add to DNS. The selector (google in the example) is chosen by the provider.
DMARC — Domain-Based Message Authentication
DMARC builds on SPF and DKIM by specifying what to do with emails that fail authentication — and gives you reporting on who's sending email using your domain.
; Quarantine failing emails and send reports to admin@example.com
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=quarantine; rua=mailto:admin@example.com; pct=100"
; Reject failing emails (strictest)
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"
DMARC policy values: none (monitor only), quarantine (send to spam), reject (block outright).
Domain Verification TXT Records
Services like Google Search Console, GitHub, Cloudflare, and others ask you to add a TXT record to prove you own the domain:
; Google Search Console verification
example.com. 3600 IN TXT "google-site-verification=abc123..."
; GitHub ownership verification
_github-challenge-myorg.example.com. 3600 IN TXT "abc123..."
6 NS Record — Name Servers
The NS record (Name Server) delegates authority for a domain or subdomain to specific DNS servers. These records tell the internet which servers hold the authoritative DNS records for your domain.
; Your domain's authoritative name servers
example.com. 172800 IN NS ns1.cloudflare.com.
example.com. 172800 IN NS ns2.cloudflare.com.
NS records are set at your domain registrar (not at your DNS provider). When you move from one DNS provider to another, you update the NS records at your registrar, and DNS propagates globally over 24–48 hours.
Subdomain Delegation
You can delegate a subdomain to a completely different DNS provider:
; Delegate mail.example.com to a separate DNS zone
mail.example.com. 3600 IN NS ns1.mailprovider.com.
mail.example.com. 3600 IN NS ns2.mailprovider.com.
NS records have very high TTLs (48 hours / 172800 seconds is common) because changing them requires global propagation and breaks resolution if done incorrectly.
7 SOA Record — Zone Authority
The SOA record (Start of Authority) is automatically created with every DNS zone. It contains metadata about the zone: the primary name server, the responsible email address, and timing parameters for zone transfers.
; SOA record format
example.com. 3600 IN SOA ns1.cloudflare.com. dns.cloudflare.com. (
2026101901 ; Serial number (YYYYMMDDNN format)
7200 ; Refresh — how often secondaries check for updates
900 ; Retry — how long after a failed refresh to retry
1209600 ; Expire — when secondary should stop responding if primary unreachable
300 ; Minimum TTL for negative caching (NXDOMAIN)
)
Most DNS providers manage the SOA record automatically. You rarely need to edit it directly. The serial number must be incremented every time you change the zone — many providers use the date-based format (YYYYMMDDNN).
8 PTR Record — Reverse DNS
A PTR record (Pointer record) is the reverse of an A record: it maps an IP address back to a hostname. PTR records live in special reverse lookup zones under in-addr.arpa (IPv4) or ip6.arpa (IPv6).
; Reverse DNS for 203.0.113.10
10.113.0.203.in-addr.arpa. 3600 IN PTR mail.example.com.
; IPv6 reverse DNS
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.0.2.2.0.0.0.8.2.6.0.6.2.ip6.arpa. 300 IN PTR example.com.
Why PTR Records Matter
- Email deliverability: Most mail servers perform a reverse DNS check on the connecting IP. If the PTR record doesn't match the A record (forward-confirmed reverse DNS, FCrDNS), the email is likely to be rejected or spam-scored heavily.
- Security logging: PTR records make server logs human-readable —
mail.example.comis more meaningful than203.0.113.10. - Compliance: Some services require PTR records as a condition of use.
PTR records are controlled by the owner of the IP address block — your hosting provider or ISP — not your domain registrar. You must request PTR record changes through your hosting provider's control panel or support team.
9 SRV Record — Service Location
An SRV record specifies the hostname and port of a service. Unlike A records, SRV records carry port information, making them useful for protocols that need to discover service endpoints dynamically.
; Format: _service._proto.name TTL class type priority weight port target
_xmpp-client._tcp.example.com. 3600 IN SRV 5 0 5222 xmpp.example.com.
_sip._tcp.example.com. 3600 IN SRV 10 20 5060 sip1.example.com.
_sip._tcp.example.com. 3600 IN SRV 10 10 5060 sip2.example.com.
Fields explained:
- Priority — lower is preferred (same as MX)
- Weight — for equal-priority records, higher weight gets more traffic (weighted load balancing)
- Port — the TCP/UDP port the service listens on
- Target — the hostname of the server (must have an A/AAAA record)
SRV records are commonly used by: Microsoft 365 (Autodiscover, Teams federation), SIP/VoIP systems, XMPP instant messaging, Minecraft server discovery, and Kubernetes service meshes.
10 CAA Record — Certificate Authority Authorization
A CAA record specifies which Certificate Authorities (CAs) are authorized to issue SSL/TLS certificates for your domain. This prevents rogue CAs from issuing fraudulent certificates for your domain.
; Only Let's Encrypt can issue certificates for example.com
example.com. 3600 IN CAA 0 issue "letsencrypt.org"
; Allow wildcard certificates from Let's Encrypt
example.com. 3600 IN CAA 0 issuewild "letsencrypt.org"
; Send certificate issue notifications to this address
example.com. 3600 IN CAA 0 iodef "mailto:security@example.com"
CAA tags:
issue— authorizes a CA to issue regular certificatesissuewild— authorizes a CA to issue wildcard certificates (*.example.com)iodef— reports unauthorized issuance attempts to the specified contact
If no CAA records exist, any CA can issue certificates for the domain (the default state). Adding CAA records is a recommended security hardening step.
Understanding TTL — Time To Live
TTL is the number of seconds a DNS resolver should cache a record before re-querying the authoritative DNS server. It appears in every record type.
| TTL | Duration | When to Use |
|---|---|---|
60 | 1 minute | During active migrations — changes propagate fast |
300 | 5 minutes | Pre-migration, or frequently changing records |
3600 | 1 hour | Standard for most records |
86400 | 24 hours | Stable records that rarely change |
172800 | 48 hours | NS records |
Lower TTLs mean faster propagation of changes but more load on authoritative DNS servers. Higher TTLs are more efficient and resilient — if your DNS provider goes down, resolvers can serve cached answers for longer.
Querying DNS from the Command Line
Using dig
# Query a specific record type
dig A example.com
dig AAAA example.com
dig MX example.com
dig TXT example.com
dig NS example.com
dig CNAME www.example.com
# Query a specific DNS server (e.g., Google's 8.8.8.8)
dig A example.com @8.8.8.8
# Short output (just the answer)
dig A example.com +short
# Full trace from root servers
dig A example.com +trace
# Query all record types
dig ANY example.com
Using nslookup
nslookup example.com
nslookup -type=MX example.com
nslookup -type=TXT example.com
nslookup -type=NS example.com
Checking PTR (Reverse DNS)
# Reverse lookup an IP address
dig -x 93.184.216.34
nslookup 93.184.216.34
For a faster, no-install approach, use the DNS Lookup Tool — it supports all record types and shows propagation status across multiple resolvers.
Common DNS Misconfigurations
CNAME on the Root Domain
The most common mistake: creating a CNAME for example.com (no subdomain). This violates RFC 1034 and breaks MX, NS, and TXT records for the root. Use an A record or your DNS provider's ALIAS/ANAME feature instead.
Missing SPF Record
Sending email without SPF will cause deliverability problems. Check with: dig TXT yourdomain.com | grep spf
Multiple SPF Records
Having two v=spf1 TXT records causes SPF to fail with a "PermError". Merge all your email providers into a single SPF record.
MX Points to a CNAME
The target of an MX record must be a hostname with its own A/AAAA record, not a CNAME. Many mail servers will reject connections from MX targets that are CNAMEs.
Forgetting to Update PTR After IP Change
After moving to a new server with a new IP, the PTR record on the old IP is no longer relevant, but more critically the new IP needs a PTR record set up with the new hosting provider. Skipping this causes email delivery failures.
Summary
DNS records are the control panel of your domain's presence on the internet. A and AAAA records direct web traffic. MX records route email. CNAME records create flexible aliases. TXT records carry security policies. NS records delegate authority. CAA records lock down who can issue your certificates. Understanding each type — and their constraints — means you can confidently configure any domain setup, debug delivery problems, and make changes safely with proper TTL management.
Bookmark the DNS Lookup Tool for instant record inspection without ever opening a terminal.