PureTools

DNS Records Explained: A, CNAME, MX, TXT, and More

PureTools Team· 7 min read
DNS Records Explained: A, CNAME, MX, TXT, and More

DNS Records: The Phone Book of the Internet

When you type example.com, your browser needs an IP address. DNS (Domain Name System) translates domain names to IPs. Each DNS record type serves a specific purpose, and as a developer, you'll configure them when setting up domains, email, SSL, and deployments.

Record Types

TypePurposeExample Value
AMaps domain to IPv4 address93.184.216.34
AAAAMaps domain to IPv6 address2606:2800:220:1:248:1893:25c8:1946
CNAMEAlias — points domain to another domainmyapp.vercel.app
MXMail server for the domain10 mail.example.com
TXTArbitrary text (SPF, DKIM, verification)v=spf1 include:_spf.google.com ~all
NSNameserver — who manages DNS for this domainns1.cloudflare.com
SRVService locator (port + host for a service)0 5 5060 sip.example.com
CAAWhich CAs can issue SSL certs for this domain0 issue "letsencrypt.org"

A Record

The most basic record. Points your domain to an IP:

example.com.    A    93.184.216.34
api.example.com A    203.0.113.42

Use A records when you know the exact IP of your server.

CNAME Record

Points a domain to another domain (alias):

www.example.com     CNAME   example.com
blog.example.com    CNAME   mysite.netlify.app
app.example.com     CNAME   myapp.vercel.app

Important: You cannot have a CNAME on the root domain (example.com). Use A records or ALIAS/ANAME records (Cloudflare supports this as "flattened CNAME").

MX Record

Tells other mail servers where to deliver email for your domain:

example.com   MX   10 alt1.gmail-smtp-in.l.google.com
example.com   MX   20 alt2.gmail-smtp-in.l.google.com

The number is priority — lower is preferred. If server 10 is down, mail goes to server 20.

TXT Record (Verification & Email Security)

# SPF — who can send email on behalf of your domain
example.com   TXT   "v=spf1 include:_spf.google.com ~all"

# DKIM — email signing key
default._domainkey.example.com   TXT   "v=DKIM1; k=rsa; p=MIGfMA0..."

# DMARC — what to do with failing emails
_dmarc.example.com   TXT   "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"

# Domain verification (Google, Vercel, etc.)
example.com   TXT   "google-site-verification=abc123..."

TTL (Time to Live)

How long DNS resolvers cache a record (in seconds):

TTL ValueDurationUse Case
3005 minutesRecords that change frequently, during migrations
36001 hourStandard for most records
8640024 hoursStable records that rarely change

Pro tip: Lower TTL before a migration so changes propagate faster. Raise it back after.

Debugging DNS

# Query A record
dig example.com A

# Query specific record type
dig example.com MX
dig example.com TXT

# Use a specific DNS server (bypass cache)
dig @8.8.8.8 example.com A

# Trace the full resolution path
dig +trace example.com

# Windows
nslookup example.com
nslookup -type=MX example.com

Common Setups

Custom domain on Vercel:

example.com      A      76.76.21.21
www.example.com  CNAME  cname.vercel-dns.com

Custom domain on Cloudflare Pages:

example.com      CNAME  your-project.pages.dev  (proxied)

Google Workspace email:

example.com  MX  1  aspmx.l.google.com
example.com  MX  5  alt1.aspmx.l.google.com
example.com  TXT "v=spf1 include:_spf.google.com ~all"

DNS lookup tool: DNS Lookup — query any domain's DNS records instantly.