DNS Records Explained: A, CNAME, MX, TXT, SRV and More
The record types you will actually use
- A — hostname to IPv4 address. The record that puts your site on the internet.
- AAAA — hostname to IPv6 address.
- CNAME — an alias pointing one hostname at another. Cannot coexist with other records on the same name, and traditionally cannot be used on the root domain.
- MX — mail exchangers with a priority number; lower numbers are tried first.
- TXT — free-form text, used for SPF, DKIM, DMARC and ownership verification.
- SRV — service location records used by VoIP, chat and Microsoft services.
- NS — delegates a zone or subdomain to other nameservers.
- CAA — restricts which certificate authorities may issue certificates for your domain.
Practical examples
; Website
@ A 3600 203.0.113.10
www CNAME 3600 yourdomain.com.
; Mail with Google Workspace
@ MX 3600 1 smtp.google.com.
; SPF (only one SPF record per domain)
@ TXT 3600 "v=spf1 include:_spf.google.com ~all"
; DMARC
_dmarc TXT 3600 "v=DMARC1; p=quarantine; rua=mailto:[email protected]; pct=100"
; Certificate authority restriction
@ CAA 3600 0 issue "letsencrypt.org"TTL strategy
TTL controls how long resolvers cache an answer. Use 3600 seconds (one hour) as a default for stable records, and drop to 300 seconds a day before any planned change so the cutover is quick. Raise it again once the change is confirmed to reduce lookup latency.
Long TTLs are not a performance win worth chasing — the risk of a slow rollback during an incident is a bigger cost than a few milliseconds per lookup.
Debugging DNS problems
dig +short A yourdomain.com @8.8.8.8
dig +short MX yourdomain.com
dig TXT _dmarc.yourdomain.com +short
dig +trace yourdomain.com # follow delegation from the rootIf different resolvers disagree, you are looking at propagation. If every resolver agrees and the site is still wrong, the problem is on the server, not in DNS.
Frequently asked questions
Can I have two SPF records?
No. Multiple SPF TXT records invalidate each other. Merge all senders into one record using multiple include: statements.
Why can't I add a CNAME on my root domain?
The DNS specification forbids it alongside SOA and NS records. Use an A record, or an ALIAS/ANAME feature if your DNS provider offers one.
Need a hand applying this?
Our engineers can do it for you. Open a ticket and we will help.