All posts

Blog

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

Illustrated cover for the Domains & DNS guide "DNS Records Explained: A, AAAA, CNAME, MX, TXT and More"

DNS is the internet's address book. When someone types your domain into a browser or sends you an email, DNS records tell their computer where to go. If you've ever been asked to "add a TXT record" or "update your MX", this guide is for you.

How DNS works, briefly

Your domain's nameservers hold its DNS zone: a list of records. Each record has:

  • A name (also called host), such as @ for the bare domain, www, or mail
  • A type, such as A, CNAME or MX
  • A value, such as an IP address or another domain name
  • A TTL (time to live), which tells other servers how long to cache the answer

If you're not sure where your DNS is managed, read nameservers vs DNS records first.

A record: domain to IPv4 address

An A record points a name to an IPv4 address, which is where your website is hosted.

Name Type Value
@ A 203.0.113.10
www A 203.0.113.10

This says "yourdomain.com and www.yourdomain.com are at server 203.0.113.10". (That address is a documentation example. Use the IP address from your welcome email.)

AAAA record: domain to IPv6 address

An AAAA record does the same job as an A record, for IPv6 addresses. Only add one if your server actually has an IPv6 address. A wrong AAAA record can make your site fail for visitors on IPv6 networks.

CNAME record: an alias for another name

A CNAME points one name to another domain name rather than an IP address.

Name Type Value
www CNAME yourdomain.com
shop CNAME stores.example-platform.com

Common uses: pointing www to your bare domain, and connecting services like online store platforms or email marketing tools.

Rules to know:

  • A name with a CNAME can't have other records, such as MX or TXT, with the same name.
  • You generally can't use a CNAME on the bare domain (@). Use an A record there.

MX record: where your email goes

MX (mail exchanger) records tell other mail servers where to deliver email for your domain.

Name Type Priority Value
@ MX 0 mail.yourdomain.com
  • The value must be a hostname, not an IP address.
  • Priority: lower numbers are tried first. Extra MX records with higher numbers act as backups.

If you move email to a different provider, you change your MX records, while your website can stay where it is.

TXT record: text for verification and email security

TXT records hold text that other services read. They're used for:

  • SPF, listing which servers may send email for your domain: v=spf1 ... ~all
  • DKIM, a public key used to verify your email's signature
  • DMARC, your policy for handling email that fails checks
  • Domain verification, proving you own a domain to services like Google Search Console
Name Type Value
@ TXT google-site-verification=abc123...
_dmarc TXT v=DMARC1; p=none; rua=mailto:you@yourdomain.com

Important: a domain should have only one SPF record. If you use several email services, combine them into one SPF record. Read SPF, DKIM and DMARC explained.

NS record: who's in charge

NS records list the nameservers responsible for your domain. You normally set these at your domain registrar rather than inside the zone. Your host's welcome email lists the nameservers to use, usually a pair such as ns1.yourhost.com and ns2.yourhost.com.

SRV and CAA records

  • SRV records point specific services, like some chat, calling or game services, to a host and port. You'll only need one if a service tells you to add it.
  • CAA records list which certificate authorities may issue SSL certificates for your domain. If you add one, make sure it allows the authority your host uses, or your free SSL may fail to renew.

TTL: how long answers are cached

TTL is measured in seconds. A TTL of 3600 means other servers may cache the record for an hour.

  • Planning a change? Lower the TTL (for example to 300 seconds) a day ahead, so the switch spreads quickly.
  • Normal operation: a TTL of an hour or more is fine.

Even with low TTLs, some changes take a while to appear everywhere. See what is DNS propagation?

Where to edit DNS records

If your domain uses your web host's nameservers, edit records in your control panel:

  • cPanel: open Zone Editor
  • DirectAdmin: open DNS Management

Common mistakes

  • Editing DNS in the wrong place. If your nameservers point elsewhere, changes in your control panel have no effect.
  • Two SPF records. Merge them into one.
  • A CNAME on the bare domain. Use an A record.
  • Deleting MX records by accident during a website move. Email stops arriving.
  • Forgetting the trailing details, such as the priority on MX records.

Tip: before changing anything, take a screenshot or export of your current zone, so you can put it back if needed.

The bottom line

A records point to IP addresses, CNAMEs point to other names, MX records route email, and TXT records handle verification and email security. Know which is which, change one thing at a time, and keep a copy of your zone before editing.