DNS Records Explained (A, CNAME, TXT, MX)
> This is the fastest way to stop DNS feeling like magic. You'll learn what each record type does and how to avoid the classic mistakes.
1) The mental model
- **Names** (like `www.yourdomain.com`) point to either an **IP** (A/AAAA) or another **name** (CNAME).
- **Email** routing uses MX (points to mail server hostnames).
- **Policies/verification** use TXT (SPF, DKIM, DMARC, site verification).
2) A record (IPv4)
Maps a name to an IPv4 address.
- Example: `@ → 203.0.113.10`
- Use it when you have a server IP and want the domain to open that server.
3) AAAA record (IPv6)
Maps a name to an IPv6 address.
- Optional if you don't run IPv6. If you set it, make sure your server and firewall are actually ready for IPv6.
4) CNAME record (alias)
Points one name to another name (alias).
- Example: `www → @` (or `www → yourdomain.com` depending on DNS UI)
- Use it when a provider gives you a hostname target (CDN, email provider, SaaS verification).
5) TXT record (text / verification / policy)
Stores text values used for verification and policies.
- Common uses: domain verification, SPF, DKIM, DMARC.
6) MX record (email routing)
Tells the world where inbound email should be delivered.
- MX points to a hostname (mail server), not an IP.
- Lower priority number is tried first.
7) TTL and propagation (why changes take time)
- **TTL** is how long resolvers cache your record.
- During migrations, use a lower TTL (e.g., 300–900 seconds), then increase it after everything is stable.
8) Practical setups (copy the pattern)
Website (typical)
- `@` → A → your server IP
- `www` → CNAME → `@`
Email on the same server (simplified)
- MX → `mail.yourdomain.com` (hostname)
- `mail` → A → your server IP
- TXT (SPF/DKIM/DMARC) as required
9) Common mistakes (and how to spot them)
- `www` has both A and CNAME (many DNS providers disallow this).
- Multiple SPF TXT records (should be one; merge mechanisms into one record).
- Wrong target type (MX set to an IP instead of hostname).
- Editing DNS in the wrong place (registrar vs DNS host).
10) Quick troubleshooting checklist
1. Confirm which DNS provider is authoritative (where you must edit records).
2. Check TTL and wait for propagation when needed.
3. Verify your record values have no typos/spaces.
4. Confirm the server is reachable (80/443 for web; 25/587/465 for mail depending on setup).
What to learn next
Page changelog
Last updated
- 2026-01-18—Initial or baseline update for this page.
Related articles
Domain & DNS
Domains & DNS Basics
Understand what DNS is, why propagation happens, and how to point a domain to your server safely.
Domain & DNS
Nameservers vs DNS Records (Beginner)
The #1 beginner confusion: where DNS lives, what nameservers do, and where you actually edit records.
Domain & DNS
DNS Propagation & TTL (Beginner)
Why DNS changes take time, what TTL really means, and how to migrate domains safely without downtime.
Was this page helpful?