Understanding DNS Records: A, AAAA, CNAME, MX, and TXT Explained

When you type a domain into a browser, your computer asks the Domain Name System where to go, and the answer comes from DNS records. Each record type answers a different question: which server holds the website, which one handles email, and which text values prove you own the domain. This guide covers DNS records explained through the five types you will meet most often, with examples and the mistakes that cause real outages.

No DNS knowledge is assumed. If you can edit records at your registrar or DNS provider, you can follow along.

DNS Records Explained: The Basics First

DNS is a distributed database. Your domain’s records live at an authoritative nameserver, usually run by your registrar or a provider like Cloudflare. When someone looks up your domain, resolvers ask that nameserver and cache the answer for a while. That cache time is the TTL, measured in seconds. A TTL of 3600 means resolvers may reuse the answer for an hour after you change it, which is why DNS changes are not instant.

Before editing anything, lower the TTL to 300 a day ahead of a planned change. That way, when you flip the record, the old answer fades within minutes instead of hours. After the change settles, you can raise the TTL again to reduce lookup load.

If you are choosing where to host your DNS, our comparison of DNS providers including Cloudflare, Route 53, and NS1 covers pricing, speed, and features.

A and AAAA Records: Where the Website Lives

The A record maps a hostname to an IPv4 address, and the AAAA record maps it to an IPv6 address. They are the most basic records, and nearly every domain has at least one:

example.com.    3600  IN  A      203.0.113.10
example.com.    3600  IN  AAAA   2001:db8::1

The dns a record vs aaaa question comes down to address family: A is for the older 32-bit IPv4 space, AAAA is for the much larger 128-bit IPv6 space. Most visitors still reach you over IPv4, but IPv6 adoption keeps growing, and adding an AAAA record costs nothing if your server supports it. If your server does not have IPv6, do not add an AAAA record pointing nowhere: visitors on IPv6 networks will try it first and fail.

The @ symbol in a DNS editor means the bare domain itself, while www is the subdomain. Both need records if you want both to work, and they can point to the same server.

CNAME Records: Aliases That Point to Names

A CNAME record makes one hostname an alias of another hostname. Instead of an IP address, its value is a target name:

www.example.com.  3600  IN  CNAME  example.com.

The cname record purpose is indirection: when the target’s address changes, all aliases follow automatically. This is why managed services ask you to create a CNAME for verification or for pointing a subdomain at their platform. You change one A record, and every CNAME pointing at it follows.

Two rules matter. First, a hostname with a CNAME cannot have other record types alongside it, which is why you cannot put a CNAME on the bare domain itself in most setups. Second, CNAME chains add lookups, so avoid pointing a CNAME at another CNAME when you can point directly at the final target.

MX and TXT Records: Email and Proof

MX records tell the world which servers accept email for your domain. They carry a priority number, where lower means tried first:

example.com.  3600  IN  MX  10  mail.example.com.
example.com.  3600  IN  MX  20  mail2.example.com.

If you use Google Workspace, Microsoft 365, or another provider, they give you the exact MX values to enter. Get them wrong and mail bounces or vanishes, so copy them character for character and test by sending yourself a message from an outside account.

TXT records hold free-form text, and their biggest job today is email authentication. SPF, DKIM, and DMARC all live in TXT records, and they tell receiving servers which senders are allowed to send as your domain. The mx txt email records pair is where most small-business email problems live: missing SPF means your mail lands in spam, and a broken DMARC policy can reject legitimate mail outright.

TXT records also prove domain ownership for services like Google Search Console and SSL certificate issuers. The service gives you a unique string, you publish it as a TXT record, and the service checks that it resolves. Remove it after verification only if the service says you can; some re-check periodically.

How the Records Work Together

A typical small setup looks like this: A and AAAA records point the domain and www at the web server, a CNAME points a subdomain like app at the platform hosting it, MX records point at the mail provider, and TXT records carry SPF, DKIM, and DMARC. Each record does one job, and together they route web traffic, email, and verification through one domain.

When something breaks, check in this order: did the record propagate, is the TTL caching an old value, and is the value itself correct? Tools like dig answer all three. dig example.com A shows the current answer, and querying your authoritative server directly with dig @ns1.provider.com example.com A shows what you published versus what the world sees.

DNS sits in front of everything else you run, including content delivery. If you are adding a CDN in front of your site, our comparison of Cloudflare, Fastly, and Bunny CDN explains how DNS and CDN caching interact.

Common Mistakes

  • Forgetting the trailing dot in a fully qualified target, which makes the provider append your domain
  • Editing the wrong zone when a domain has DNS at both the registrar and a CDN
  • Adding an AAAA record for a server without IPv6 support
  • Leaving old MX records in place after switching mail providers
  • Publishing SPF with multiple records instead of merging into one

DNS looks simple on the surface, and that is exactly why small mistakes cause confusing outages. Change one record at a time, verify with dig, and keep a note of what each record is for. The next person to touch the zone, possibly future you, will thank you.

For related networking groundwork, our comparison of mesh VPN options including Tailscale, ZeroTier, and NetBird covers private networking that sits alongside public DNS.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.