DNS records explained: A, AAAA, CNAME, MX, TXT, NS and the rest
What each common DNS record type does, the rules that trip people up – CNAMEs at the root, MX pointing at an IP – and how TTL and caching really work.
In short
DNS records hold the addresses and settings for a domain: A and AAAA map a name to IPv4 and IPv6 addresses, CNAME aliases one name to another, MX names the mail servers, TXT carries SPF, DKIM and DMARC, and NS lists the nameservers. Changes appear as caches expire, which each record's TTL controls; nothing is pushed out.
On this page
DNS is the internet's directory: it turns a name such as example.co.uk into the addresses and settings that computers need. Almost every problem with a website or email – "the site has gone", "mail is bouncing", "Google cannot verify the domain" – ends up as a question about one DNS record. Knowing what each record type does, and the handful of rules that catch people out, makes those problems much quicker to solve.
You can look up any record described here with our DNS Lookup tool, which queries Cloudflare's or Google's public resolvers so you see what the rest of the world sees, not what your own computer has cached.
Where your records live
#Every domain has a set of authoritative nameservers holding its records, called its zone. The registrar where you bought the domain records which nameservers those are. The two are often the same company but do not have to be: a domain registered with one firm can have its DNS hosted by another, such as Cloudflare or your web host.
This is the first thing to establish when a change "is not working": are you editing records at the company that actually answers for the domain? Our WHOIS Lookup shows the nameservers the registry has on file, and a DNS lookup of the domain's NS records confirms what is answering. Records added at any other provider are simply never seen.
The common record types
#| Type | What it holds | Typical use |
|---|---|---|
A | An IPv4 address | Points a name at a web server |
AAAA | An IPv6 address | The IPv6 equivalent of A |
CNAME | Another name (an alias) | Points www or a service subdomain at a provider |
MX | A mail server name and a priority | Says where email for the domain is delivered |
TXT | Free text | SPF, DMARC, DKIM keys and ownership verification |
NS | Nameserver names | Delegates a domain or subdomain to its DNS host |
SOA | Zone administration data | Serial number and caching timers for the zone |
CAA | Certificate authority names | Restricts which authorities may issue SSL certificates |
SRV | Host, port, priority and weight | Locates services such as SIP or some chat systems |
PTR | A name, for an IP address | Reverse DNS, used heavily in email filtering |
A and AAAA: names to addresses
#An A record maps a name to an IPv4 address; AAAA (pronounced "quad-A") does the same for IPv6. A name can have several of each, and resolvers return them all; clients pick one, which spreads load and provides a fallback.
If you publish an AAAA record, it must work. Visitors whose connection has IPv6 will usually try it first, and if the server does not answer on IPv6 they can see a slow page or a failure while everyone else is fine – an outage that is very hard to reproduce. When moving hosts, remember to update or remove the AAAA record as well as the A record.
CNAME: an alias, with strict rules
#A CNAME says "this name is another name; look that up instead". It is how you point www.example.co.uk at a hosting platform, or shop.example.co.uk at an e-commerce provider, without copying their IP addresses into your zone.
The specification gives CNAMEs a rule that causes more confusion than anything else in DNS: a name with a CNAME may have no other records. That has two consequences:
- You cannot put a CNAME at the root of your domain (
example.co.ukitself), because the root must also hold yourNSandSOArecords, and usually holdsMXandTXTrecords too. Many DNS providers offer a workaround called ALIAS, ANAME or "CNAME flattening", which looks up the target and publishes its addresses as ordinary A records. - You cannot add a TXT record to a name that is a CNAME. If a verification service asks for a TXT record on
shop.example.co.ukand that name is already a CNAME, the TXT record will be ignored or rejected.
MX: where email goes
#An MX record names a server that accepts email for the domain, with a priority number. Lower numbers are tried first; servers with higher numbers are backups. Two rules matter:
- An MX record must point at a name, not an IP address.
10 203.0.113.5is invalid; create an A record such asmail.example.co.ukand point the MX at that. - The name it points at should not be a CNAME. The standards forbid it, and while some senders cope, others do not.
MX records only control incoming mail. Whether your outgoing mail is trusted is decided by SPF, DKIM and DMARC, which are TXT records – see our guide to setting them up for Microsoft 365. Our Email Validator shows the MX records for any address's domain.
TXT: the record that does everything else
#A TXT record holds text, and services have adopted it for almost every kind of configuration: SPF (v=spf1 …) at the root, DMARC at _dmarc, DKIM public keys at selector._domainkey, and the verification codes that Google, Microsoft and others ask you to publish to prove you own a domain.
Each string inside a TXT record is limited to 255 characters. Longer values – a 2048-bit DKIM key, for instance – are split into several quoted strings within the same record, which receivers join back together. Most DNS control panels do this for you; a few need it entered by hand. A domain can have many TXT records, but must have only one SPF record.
NS and SOA: how the zone is run
#NS records list a zone's nameservers. At the root they should match what the registrar has on file; on a subdomain they delegate that subdomain to a different DNS host entirely, which is how a provider can manage mail.example.co.uk while you keep the rest.
The SOA (start of authority) record holds administrative values for the zone. The one worth knowing is the last field, which sets how long resolvers may cache a "this name does not exist" answer (or the SOA record's own TTL, if that is shorter). If you look up a name before creating it, that negative answer can stick for the length of this timer, which is why a newly added record sometimes seems not to appear.
CAA: who may issue your certificates
#A CAA record lists the certificate authorities allowed to issue SSL certificates for your domain, for example 0 issue "letsencrypt.org". Authorities are required to check it before issuing. It is a sensible protection, but it can also break automatic renewal if your host switches to an authority your record does not list. If certificate renewal suddenly fails, check for a CAA record.
SRV and PTR
#SRV records advertise where a particular service runs, using names such as _sip._tls.example.co.uk, with a host, port, priority and weight. You will usually only meet them when a phone system or collaboration tool asks you to add one.
PTR records do the reverse of A records: they map an IP address back to a name. They are not in your domain's zone at all; they are controlled by whoever holds the IP address – your hosting company or internet provider. Mail servers check them, and a sending server with no reverse DNS, or one that does not match its forward record, is treated with suspicion. Our DNS Lookup tool does PTR lookups if you enter an IP address.
TTL and the myth of "propagation"
#Every record has a TTL (time to live), in seconds, telling resolvers how long they may cache it. A TTL of 3600 means a resolver that looked the record up a minute ago may keep using the old answer for another 59 minutes.
That is all "DNS propagation" really is: caches expiring at different times around the world. Nothing is being pushed out. It has two practical consequences:
- Before a planned change, lower the TTL – to 300 seconds, say – a day in advance. When you make the change, caches catch up within minutes. Raise it again afterwards.
- When a change seems not to work, check from outside. Your own computer and router cache too. A lookup through a public resolver, as our tool does, shows what a new visitor would see.
A quick troubleshooting order
#- Confirm which nameservers the domain is delegated to, and that you are editing records there.
- Look up the exact name and type through a public resolver.
- Check for duplicate or conflicting records – two SPF records, a CNAME alongside other records, an old AAAA record.
- Check the TTL to know how long caches may hold the old value.
- If the name returns "does not exist" right after you created it, wait for the negative-caching time in the SOA record.
If the problem is a website that will not load at all, our guide to diagnosing a website that is down puts DNS in context with the other layers to check.