CompareHostingOnline

Home / Guides / What are DNS records? A, CNAME, MX and TXT explained

Guide

What are DNS records? A, CNAME, MX and TXT explained

The DNS record types you will meet when you set up a site or email, what each does, how TTL and propagation work and a safe way to change records.

By Muhammad Hamza, Founder & EditorUpdated Nov 30, 2026
A93.184.216.34AAAA2606:2800:…MX10 mail.example.comNSns1.example.netTXTv=spf1 -all

Short answer

DNS records are instructions stored for your domain. An A record points the name to a server's IPv4 address, a CNAME makes one name an alias of another, MX records say where email goes and TXT records hold text such as SPF and verification codes. Each record has a TTL that controls how long it is cached.

Last verified Nov 28, 2026 · How we test
At a glance
  • What is a DNS record?The domain name system is a distributed phone book.
  • Which DNS record types do you need to know?For a normal website you mostly need A (and AAAA) records.
  • What is the difference between an A record and a CNAME?An A record maps a name straight to an IP address.

What is a DNS record?

The domain name system is a distributed phone book. For each domain there is a set of records held by its authoritative nameservers. When a browser, mail server or other program needs something about your domain, it asks DNS and gets the matching records back.

Each record has a name, a type, a value and a TTL. The name says which hostname it applies to (the bare domain, www, mail and so on). The type says what kind of answer it is. The value is the answer. The TTL says how many seconds others may cache the answer.

Which DNS record types do you need to know?

For a normal website you mostly need A (and AAAA) records. Email adds MX and several TXT records. A CNAME is common for www and for third-party services, and CAA is an optional safety record.

TypeWhat it doesExample value
APoints a name to an IPv4 address203.0.113.10
AAAAPoints a name to an IPv6 address2001:db8::10
CNAMEMakes a name an alias of another nameshops.example.net
MXNames the mail servers for the domain, with a priority10 mail.example.com
TXTHolds text: SPF, DKIM, DMARC, domain verificationv=spf1 include:_spf.example.net ~all
NSLists the nameservers that answer for the domainns1.example.net
CAASays which certificate authorities may issue certificates0 issue “letsencrypt.org”

What is the difference between an A record and a CNAME?

An A record maps a name straight to an IP address. A CNAME maps a name to another name, and DNS then looks up that name. That is handy when a service gives you a hostname instead of an address, because the provider can change the IP address without you editing anything.

There is one important rule: a name that has a CNAME cannot also hold other records. That is why the bare domain (example.com), which needs NS and often MX and TXT records, normally uses an A record rather than a CNAME. Some DNS providers offer a flattened alias to work around it, but it is a provider feature, not a standard record type.

How do MX, SPF, DKIM and DMARC fit together?

MX records decide where incoming mail is delivered. The other three are TXT records that help receiving servers trust the mail you send. SPF lists the servers allowed to send for your domain. DKIM adds a cryptographic signature that proves a message was not altered. DMARC tells receivers what to do when SPF or DKIM checks fail and where to send reports.

If you move email to a new provider, update all four. A common cause of mail landing in spam after a migration is an old SPF record that does not include the new sender.

What is TTL and why do DNS changes take time?

TTL, or time to live, is the number of seconds a resolver may keep an answer before asking again. If your A record has a TTL of 3600, a resolver that cached it a minute ago will keep serving the old address for up to another 59 minutes. This is the real meaning of “propagation”: there is no single broadcast, just caches expiring at different times.

Planning a move? Lower the TTL to 300 seconds a day or two before the change, make the change, then raise it again afterwards. Changing the records first and the TTL second does not help, because resolvers already hold the old, long-lived answer.

How do you change DNS records safely?

Our DNS lookup tool shows the records resolvers return for any domain. Compare its output with your list after every change.

  1. Export or copy what exists

    Write down every record before you touch anything, including MX and TXT.

  2. Change one thing at a time

    Make a single change, then test it before the next.

  3. Check from outside

    Use a lookup tool to see what other resolvers return, not only your own computer.

  4. Keep the old setup running

    Leave the old server up until the new records have been live for a few days.

What are the most common DNS mistakes?

  • Deleting MX records while changing nameservers and losing email.
  • Adding a CNAME on the bare domain where other records already exist.
  • Forgetting the www record, so only one of example.com and www.example.com works.
  • Leaving a very long TTL in place before a migration.
  • Typing the value with a trailing space or the wrong quotation marks in a TXT record.

How does a DNS lookup actually happen?

When a browser needs example.com, it first asks a recursive resolver, usually run by your internet provider or a public service. If the resolver has the answer cached and the TTL has not expired, it replies at once. If not, it starts at the root, asks the .com servers which nameservers are responsible for example.com, then asks those nameservers for the record. The answer is cached on the way back.

This is why changes seem inconsistent: different resolvers cached the answer at different times. It also explains why DNS is fast. Most lookups are answered from a nearby cache, and only the first request in a while travels the full path.

What records does a typical website need?

When you are not sure what your domain already uses, run a lookup first. Our DNS lookup tool lists the records resolvers return, and our who hosts this website tool can show which provider is behind an address.

GoalRecords you set
A site on one serverA for the bare domain, A or CNAME for www
A site with IPv6Add AAAA records that match the A records
Email at the domainMX records, plus SPF, DKIM and DMARC as TXT records
Proof of ownership for a tool or search consoleA TXT record, or a CNAME, given by the service
A shop or app on a subdomainA or CNAME for the subdomain, such as shop.example.com
Restricting certificate issuanceA CAA record naming the allowed authority

What do DNS records have to do with hosting?

Your host gives you either nameservers or an IP address, and DNS records are how your domain uses them. If you are connecting a domain for the first time, follow how to point a domain to your hosting. If you change providers, plan the switch with the website migration checklist and read nameservers explained first, because many outages during migrations are DNS mistakes, not hosting problems.

How can you troubleshoot DNS problems?

  • Query the authoritative nameservers directly, not only a public resolver, to see the true value.
  • Compare answers from two or three resolvers. Different answers mean a cache has not expired.
  • Check the exact name: example.com and www.example.com are different names with separate records.
  • Look for a CNAME on a name that also has other records, which is not allowed.
  • Check whether DNSSEC is enabled. A broken DNSSEC chain makes validating resolvers refuse to answer.
  • After a fix, wait for the TTL that was in place before the fix, not the new one.

Sources and further reading

Common questions

What is the difference between an A record and a CNAME record?

An A record points a name to an IPv4 address. A CNAME points a name to another name, and DNS then resolves that name. A name with a CNAME cannot hold other records, so the bare domain normally uses an A record.

What does TTL mean in DNS?

TTL, time to live, is the number of seconds a resolver may cache an answer. A TTL of 3600 means up to an hour. Lower it a day before a planned change so old answers expire quickly and the switch reaches visitors sooner.

Why is my DNS change not showing yet?

Almost always caching. Resolvers keep the old answer until its TTL ends. Check the record at the authoritative nameserver, compare with a public resolver and wait for the old TTL. Also confirm you edited the right name, such as www or the bare domain.

What are SPF, DKIM and DMARC records?

They are TXT records that help receivers trust your mail. SPF lists servers allowed to send for your domain, DKIM adds a signature to messages and DMARC tells receivers what to do with mail that fails and where to send reports.

How do I look up the DNS records of a domain?

Use a DNS lookup tool, such as ours, or a command-line tool like dig. Look up the specific type you need, for example A, MX or TXT, and query more than one resolver if you suspect caching is hiding a recent change.

Related

More guides

Esc

Use the arrow keys, then Enter.