DNS records explained: A, AAAA, CNAME, MX and TXT

What each common DNS record does, how lookups and caching work, and how to read and fix your own zone.

A wooden card catalogue cabinet with an open drawer of blank cards

DNS is the system that turns a name like example.com into the addresses and settings that make your website and email work. Most of the time you only touch it when something new needs connecting: a hosting provider, a mailbox, a verification code.

This guide is for developers and site owners who want to understand what they are pasting into that DNS screen. By the end you will know what the five common record types do, the rules that trip people up, how caching affects changes, and how to check your records yourself.

How a DNS lookup works

When someone visits example.com, their device asks a recursive resolver (usually run by their ISP, or a public one such as 1.1.1.1 or 8.8.8.8). If the resolver doesn't have the answer cached, it asks a root server, which points it to the servers for .com. Those point it to your domain's authoritative nameservers, which hold your records and give the final answer.

How a DNS lookup travels from the browser to the authoritative nameserver
A resolver walks from the root to the TLD to your nameservers, then caches the answer

The resolver then caches that answer for as long as the record's TTL allows. This caching is what people mean by "propagation": nothing is pushed out, old answers simply expire.

The anatomy of a record

In zone-file notation, which most DNS tools follow, a record has a name, a TTL in seconds, a class (almost always IN), a type and a value:

DNS
www.example.com.  3600  IN  A  192.0.2.10

A name ending in a dot is fully qualified. In dashboards you usually type only the part before your domain (www), and @ stands for the root domain itself.

A and AAAA records

An A record maps a name to an IPv4 address. An AAAA record does the same for IPv6.

DNS
example.com.      3600  IN  A     192.0.2.10
example.com.      3600  IN  AAAA  2001:db8::10

You can publish several A records for one name and resolvers return all of them, but clients pick one without checking whether it is healthy, so this is not real load balancing. Only add an AAAA record if the server actually answers over IPv6. Many clients prefer IPv6, so a wrong AAAA record breaks the site for a large share of visitors while it looks fine on your own connection.

CNAME records

A CNAME says "this name is an alias for another name". The resolver then looks up the target.

DNS
www.example.com.   3600  IN  CNAME  example.com.
shop.example.com.  3600  IN  CNAME  myapp.example.net.

CNAMEs are useful when a provider might change its IP addresses: you point at their name and they keep the addresses up to date. Three rules matter:

  • A CNAME must be the only record at its name. You can't have a CNAME and a TXT or MX record on shop.example.com.
  • So a CNAME can't sit on the root domain, because the root always has NS and SOA records. Some providers offer CNAME flattening, ALIAS or ANAME records to work around this; otherwise use an A record.
  • An MX record must point to a hostname with its own A or AAAA record, never to a CNAME.

MX records

MX records say which servers accept email for your domain. Each has a priority, and lower numbers are tried first.

DNS
example.com.  3600  IN  MX  10 mx1.example.net.
example.com.  3600  IN  MX  20 mx2.example.net.

Senders try mx1 first and fall back to mx2 if it doesn't answer. Two records with the same priority share the load. The target is always a hostname, not an IP address.

Use the MX records your email provider gives you, and only those. Mixing two providers' MX records means some mail lands in one place and some in another. Premium Email, for example, uses two MX records, which are added automatically on RemoteGeeks DNS or shown under View DNS instructions otherwise.

TXT records

A TXT record holds free text. In practice it carries machine-readable settings: domain ownership checks, SPF, DKIM and DMARC.

DNS
example.com.          3600  IN  TXT  "v=spf1 include:_spf.google.com ~all"
example.com.          3600  IN  TXT  "google-site-verification=abc123"
_dmarc.example.com.   3600  IN  TXT  "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

A name can have many TXT records, and they don't interfere with each other, with one exception: a domain must have only one SPF record (the one starting v=spf1). Each quoted string is limited to 255 characters, so long values such as DKIM keys are split into several strings inside one record. Most dashboards do this for you. The SPF, DKIM and DMARC guide covers the email records in detail.

Other records worth recognising

DNS
example.com.            86400  IN  NS   ns1.example.net.
example.com.            3600   IN  CAA  0 issue "ca.example.net"
_sip._tcp.example.com.  3600   IN  SRV  10 60 5060 sip.example.com.
  • NS records delegate your domain to its nameservers. They are set where the domain is registered.
  • CAA records limit which certificate authorities may issue certificates for your domain. With no CAA record, any may.
  • SRV records advertise a service's host and port, in the order priority, weight, port, target. Some calling and chat systems use them.

TTL: how long answers are cached

TTL is set per record, in seconds. Common values are 300 (five minutes), 3600 (an hour) and 86400 (a day).

A long TTL means fewer lookups and slightly faster repeat visits. A short TTL means changes take effect quickly. A sensible pattern is to keep 3600 day to day, lower it to 300 at least one old TTL before a planned change, then raise it again once things are stable.

Negative answers are cached too. If a name was looked up before you created it, the "doesn't exist" answer can linger for the time set in your zone's SOA record.

Managing records: RemoteGeeks DNS or custom nameservers

A domain registered with RemoteGeeks uses either RemoteGeeks DNS or custom nameservers (at least two). With RemoteGeeks DNS, or a Cloudflare account you have connected, you edit A, AAAA, CNAME, MX and TXT records on the domain's page. With custom nameservers, every record lives at that DNS provider instead.

If you need other types such as CAA or SRV, manage the zone at a DNS provider that supports them. Changing nameservers moves every record at once, so copy all existing records to the new provider first. A nameserver change can take a few hours to reach everyone.

Step by step: add a record in RemoteGeeks DNS

  1. Open Domains in your dashboard and choose the domain.
  2. Check that it uses RemoteGeeks DNS or a connected Cloudflare account. If it uses custom nameservers, add the record at that provider instead.
  3. Choose the record type and enter the name: the part before your domain, such as www, or the root as the form shows it.
  4. Enter the value. For MX, enter the mail server and its priority.
  5. Click Add.
  6. Check the result from a terminal with dig, as shown below.

Checking records with dig

Terminal
dig +short A example.com
dig +short AAAA example.com
dig +short CNAME www.example.com
dig +short MX example.com
dig +short TXT example.com
dig +short NS example.com

# Ask one of your authoritative nameservers directly, skipping caches
dig @ns1.example.net +short A example.com

# Follow the whole chain from the root
dig +trace example.com

If the authoritative server shows the new value but a public resolver doesn't, you are waiting for a cache to expire. If the authoritative server shows the old value, the change wasn't saved where you think.

Common mistakes

  • Doubling the domain. Typing www.example.com into a field that appends the domain gives www.example.com.example.com. Type www.
  • Two SPF records. Merge them into one v=spf1 record.
  • A CNAME next to other records. Remove the CNAME or the other records; they can't share a name.
  • Editing at the wrong provider. Run dig +short NS to see which nameservers are in charge.
  • Changing nameservers without copying records. Email stops when MX records don't come across.
  • Stale AAAA records. Delete them when you move servers, or IPv6 visitors reach the old one.

Security notes

  • Everything in public DNS is readable by anyone. Never put secrets or internal hostnames in TXT records.
  • Remove records that point at services you no longer use. A dangling CNAME can let someone claim that service and serve content on your subdomain.
  • Protect your registrar and DNS accounts with two-factor authentication, and keep transfer lock on.
  • Consider a CAA record once you know which certificate authorities you use.
  • Turn on DNSSEC where your DNS provider supports it, which protects against forged answers.

Troubleshooting

A change isn't showing up

Compare the authoritative answer (dig @your-nameserver) with a public resolver. If they differ, wait for the old TTL to pass. If the authoritative answer is wrong, re-check the record you saved.

Email stopped after a DNS change

Run dig +short MX example.com. If it is empty, the MX records were lost, usually in a nameserver change. Re-add the values your email provider gives you.

"Record conflicts with an existing record"

You are trying to add a CNAME where other records exist, or another record where a CNAME exists. Decide which one the name should have.

Frequently asked questions

Why can't I put a CNAME on my root domain?

A CNAME must be the only record at its name, and the root always has NS and SOA records, plus usually MX and TXT. Use an A record, or a flattening or ALIAS feature if your provider has one.

How long does DNS propagation take?

As long as the old answer's TTL, plus any cached negative answers. With a TTL of 300, most people see changes within minutes. Nameserver changes can take a few hours.

Can one name have both A and AAAA records?

Yes, and that is normal for sites reachable over IPv4 and IPv6. Make sure both point at working servers.

How many TXT records can I have?

Several on the same name is fine. Just keep a single SPF record per domain.

Next steps

You can now read a zone, spot the common conflicts and check any record yourself. Put it to use connecting a domain to your app or setting up email authentication.

Share this articleLinkedIn (opens in a new tab)X (opens in a new tab)Facebook (opens in a new tab)
Was this article helpful?

Get new guides in your inbox.

One email a month. Unsubscribe anytime.