DNS record types explained: A, AAAA, CNAME, MX, TXT and more
What each common DNS record does, from A and CNAME to MX, TXT, NS, SOA, CAA and PTR, with a short example of each and the mistake people most often make with it.
Published
On this page
The short answer: a DNS record is one entry in your domain's public settings. Each type does one job: A and AAAA records give the address of a server, CNAME makes one name an alias of another, MX says where email goes, TXT holds text such as email policies, NS and SOA describe the zone itself, CAA says who may issue certificates, and PTR turns an IP address back into a name. Most problems come from a small number of well-known mistakes, such as a CNAME at the top of a domain or an old MX record left behind.
This guide explains what each common record type is for, shows a short example of each, and lists the mistake people most often make with it.
How DNS records fit together
Your domain's DNS is stored in a zone, held by the company that runs your nameservers. This is often your registrar or hosting company, or a service such as Cloudflare. Each record in the zone has four main parts:
- Name: the part of the domain it applies to.
@or a blank name means the domain itself, also called the apex or root, such asexample.com.wwwmeanswww.example.com. - Type: A, MX, TXT and so on.
- Value: the answer, such as an IP address or a host name.
- TTL: how long, in seconds, other servers may keep a copy of the answer before asking again.
The record types and their basic format are defined in RFC 1035, with later RFCs adding newer types. The examples below use the format you'll see in a zone file or in a tool's results: name, TTL, type, then value. Your DNS provider's control panel may show the same fields in a form instead.

A and AAAA: where a name lives
An A record gives the IPv4 address for a name. An AAAA record (said "quad A") does the same for an IPv6 address, as set out in RFC 3596. These are the records a browser needs to reach your website.
example.com. 3600 A 192.0.2.10
example.com. 3600 AAAA 2001:db8::10
A name can have several A or AAAA records. Visitors are then spread across those addresses.
Common mistake: an AAAA record left over from an old server. If your new host has no IPv6, delete the old AAAA record. Otherwise visitors whose devices prefer IPv6 are sent to a server that no longer exists, and the site works for some people but not others.
CNAME: one name is an alias for another
A CNAME record says "this name is really that other name". It's often used to point www or a subdomain at a hosted service, so the service can change its addresses without you changing anything.
www.example.com. 3600 CNAME example.hosting-provider.net.
Common mistake: a CNAME at the apex. A name that has a CNAME can't have any other records, as RFC 2181 (section 10.1) explains. The apex always needs NS and SOA records, and usually MX and TXT records too, so a true CNAME can't go there. Some providers offer a workaround called CNAME flattening or ALIAS: Cloudflare's CNAME flattening, for example, looks up the target itself and answers with plain A and AAAA records. If your provider doesn't offer this, use A and AAAA records at the apex and a CNAME for www only.
The same rule catches people out with subdomains. If mail.example.com is a CNAME, you can't also give it an MX or TXT record.
Try it now
DNS Lookup
Look up the DNS records for a domain: A, AAAA, CNAME, MX, NS, TXT, SOA and CAA, or the reverse DNS (PTR) name of an IP address.
MX: where your email goes
An MX record names the server that accepts email for your domain, with a priority number. Senders try the lowest number first.
example.com. 3600 MX 10 mx1.mail-provider.example.
example.com. 3600 MX 20 mx2.mail-provider.example.
Common mistake: pointing an MX record at an IP address or at a CNAME. The value must be a host name with its own A or AAAA record. RFC 2181 (section 10.3) says it "must not be an alias". The other usual problem is an old provider's MX record left in place after a move, so some mail still goes to the old system. Our guide on MX records covers these problems and how to fix them.
TXT: text, policies and proof of ownership
A TXT record holds free text. Over time it has become the home for many settings that other systems read:
- SPF, at the domain itself, lists the servers allowed to send your email:
v=spf1 include:_spf.example.net -all. - DKIM public keys, at names like
selector1._domainkey.example.com. - DMARC, at
_dmarc.example.com, says what receivers should do with mail that fails the checks. - Verification codes from services such as Google or Microsoft, proving you control the domain.
example.com. 3600 TXT "v=spf1 include:_spf.example.net -all"
_dmarc.example.com. 3600 TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"
Common mistake: two SPF records. A domain can have many TXT records, but only one may start with v=spf1. With two, SPF fails for every message. Merge them into one record. Long values, such as 2048-bit DKIM keys, are split into several quoted strings of up to 255 characters each. That's normal and doesn't cause any problem.
NS and SOA: who runs the zone
NS records list the nameservers that answer for your domain. They appear twice: in your own zone, and at the registry for your domain ending (such as .com or .uk), where you set them through your registrar. The registry copy is the one that counts when the rest of the internet looks up your domain.
example.com. 86400 NS ns1.dns-host.example.
example.com. 86400 NS ns2.dns-host.example.
The SOA record (start of authority) holds the zone's settings: the main nameserver, a contact address, a serial number that goes up with each change, and timers. One of them sets how long other servers may remember that a name doesn't exist. You rarely edit it by hand: most providers manage it for you.
Common mistake: adding records at the wrong provider. If your registrar's NS records point to Cloudflare, records you add in the registrar's own DNS page have no effect. Check the NS records first, then make changes wherever they point.
CAA: which authorities may issue certificates
A CAA record lists the certificate authorities allowed to issue SSL/TLS certificates for your domain. Under RFC 8659, a certificate authority must check for CAA records before it issues a certificate. If there are CAA records and it isn't listed, it must refuse.
example.com. 3600 CAA 0 issue "letsencrypt.org"
example.com. 3600 CAA 0 iodef "mailto:security@example.com"
CAA is optional. With no CAA record, any certificate authority may issue. The issuewild tag sets a separate rule for wildcard certificates, and iodef gives an address for reports.
Common mistake: moving to a new certificate provider, or adding a service that gets its own certificates, without adding it to CAA. The certificate renewal then fails, often weeks later when the old certificate is about to expire.
Try it now
CAA Checker
Check a domain's CAA records: which certificate authorities may issue certificates, wildcard rules, report addresses and common mistakes.
PTR: from an IP address back to a name
A PTR record does the reverse of an A record: it gives the name for an IP address. It's stored under special domains, in-addr.arpa for IPv4 and ip6.arpa for IPv6, with the address written backwards.
10.2.0.192.in-addr.arpa. 3600 PTR mail.example.com.
Mail servers check PTR records on the servers that connect to them, so they matter if you run your own mail server.
Common mistake: trying to add a PTR record in your own domain's zone. PTR records are set by whoever owns the IP address, usually your hosting company or internet provider. Our guide on reverse DNS for mail servers explains how to ask for one and check it.
Other records you may see
- SRV records give the host name and port for a particular service, such as
_sip._tcp.example.comfor internet phone systems or_autodiscover._tcpfor email set-up. Microsoft Teams and some games and chat services use them. - DS and DNSKEY records are part of DNSSEC, which adds signatures to DNS answers so they can't be quietly changed. DNSKEY holds the zone's public keys. DS records sit at the registry and link your zone to the one above it. A DS record that doesn't match your current keys makes your whole domain fail for any resolver that checks signatures.
- HTTPS and SVCB records are newer types that tell browsers which protocols a site supports before they connect. Some providers add them for you automatically.
Reading DNS results
When you look up a name, you'll see a few extra details beside the records themselves:
| You see | What it means |
|---|---|
A trailing dot, as in mail.example.com. | A full name. In a zone file, a name without the dot has the domain added to the end, which is a common cause of names such as mail.example.com.example.com. |
| A CNAME before the A records | The name is an alias. The tool followed it to the real name and then found the addresses. |
| No records of that type | The name exists but has nothing of that type. That's different from the name not existing at all. |
| Different answers at different times | Usually caching: some servers still hold the old answer until its TTL runs out. |
Common questions
How many records can a domain have?
There's no small fixed limit. A domain usually has a handful of A, AAAA, MX and NS records, plus many TXT records. Some types are limited by their own rules: only one SPF record, and only one CNAME on a name with nothing else beside it.
Should www be a CNAME or an A record?
Either works. A CNAME is easier if your host may change its addresses, because you never need to update it. An A record is fine if the address is stable or the host asks you to use one.
What does @ mean in my DNS control panel?
It stands for the domain itself, such as example.com. Some panels show it as a blank name instead.
Why do I see records I didn't add?
Many providers add defaults, such as NS and SOA records, or MX and SPF records for their own email service. Check with your provider before you remove them, especially if you use their mail.
Checklist
- You know which provider your NS records point to, and you make changes there.
- The apex has A (and AAAA, if you use IPv6) records, not a plain CNAME.
- Every MX record names a host with its own A or AAAA record.
- There's exactly one SPF TXT record.
- CAA, if you use it, lists every certificate authority you rely on.
- No leftover records point to old servers or services.
Related tools
-
DNS Lookup
Look up the DNS records for a domain: A, AAAA, CNAME, MX, NS, TXT, SOA and CAA, or the reverse DNS (PTR) name of an IP address.
-
MX Lookup
Find which mail servers receive email for a domain: MX records in priority order, each host's IPv4 and IPv6 addresses, null MX and common mistakes.
-
CAA Checker
Check a domain's CAA records: which certificate authorities may issue certificates, wildcard rules, report addresses and common mistakes.
-
DNSSEC Checker
Check whether a domain uses DNSSEC and whether its signatures validate, with DS and DNSKEY details, algorithm advice and signature expiry dates.
-
Reverse DNS
Find the PTR host name for an IPv4 or IPv6 address, and check that the name points back to the same address (forward-confirmed reverse DNS).
More DNS guides
-
DNS
CAA records: control who can issue your certificates
How CAA records limit which certificate authorities may issue certificates for your domain, how to write them, and how to avoid blocking your own renewals.
-
DNS
Changed your DNS? Why updates take time (TTL explained)
Why DNS changes are not instant, what TTL means, how to plan a change so it takes minutes rather than hours, and why nameserver moves take longer.
-
DNS
DNSSEC explained: what it protects and how to spot a broken setup
What DNSSEC protects against, how the chain of trust from the root to your domain works, and how to spot and fix a broken setup after a DNS provider change.