DNS record types explained: A, AAAA, MX, TXT, CNAME and more
A DNS record is an entry in a domain’s zone that answers one question about a name. An A record answers “which IPv4 address?”, an MX record answers “which server receives this domain’s email?”, and so on. Every record has a name, a type, a TTL (how many seconds resolvers may cache it) and a value.
| Type | What it holds | Example value |
|---|---|---|
| A | IPv4 address | 192.0.2.10 |
| AAAA | IPv6 address | 2001:db8::10 |
| CNAME | Alias to another name | shop.example.net. |
| MX | Mail server and its priority | 10 mail.example.com. |
| NS | Authoritative nameserver | ns1.example.net. |
| TXT | Text, including SPF, DMARC and verification codes | "v=spf1 include:_spf.example.net -all" |
| SOA | Zone settings | ns1.example.net. hostmaster.example.com. 2026093001 7200 3600 1209600 300 |
| CAA | Certificate authorities allowed to issue | 0 issue "letsencrypt.org" |
| SRV | Host and port for a service | 10 5 5060 sip.example.com. |
| PTR | Hostname for an IP address | mail.example.com. |
| NAPTR | Rewrite rules for services such as SIP | 100 10 "S" "SIP+D2U" "" _sip._udp.example.com. |
| DS | Hash of the domain’s key, stored in the parent zone | 12345 13 2 [digest] |
| DNSKEY | Public key that signs the zone | 257 3 13 [key data] |
A and AAAA records
An A record maps a name to an IPv4 address, and an AAAA record maps it to an IPv6 address. A name can have several of each. Clients pick one of the addresses, which spreads the load across servers.
CNAME records
A CNAME makes one name an alias for another. The resolver follows it and returns the target’s records. A name with a CNAME cannot have any other records, so you cannot put a CNAME on the domain itself (example.com), only on names below it such as www.example.com. Some DNS providers offer an ALIAS or ANAME record that works around this.
MX records
MX records name the servers that accept email for a domain, each with a priority. Senders try the lowest number first. An MX record must point to a hostname that has A or AAAA records, not to an IP address or a CNAME. A domain that accepts no email can say so with a single null MX record pointing to “.” (RFC 7505). Look up any domain’s mail servers with the MX lookup.
TXT records
TXT records hold free text, and several standards use them. SPF records (v=spf1) list the servers allowed to send email. DMARC records live at _dmarc.example.com and DKIM public keys at selector._domainkey.example.com. Services such as Google Search Console ask you to add a TXT record to prove you own a domain. Each string in a TXT record is limited to 255 characters, so longer values are split into several strings that are joined back together. The SPF, DKIM and DMARC guide covers the email records in detail.
NS and SOA records
NS records list the authoritative nameservers for a zone. They appear twice: in the parent zone (for example .com), which delegates the domain, and in the domain’s own zone. The SOA (start of authority) record holds the zone’s settings: the primary nameserver, an administrator email written with a dot instead of @, a serial number that increases with each change, timers for zone transfers, and how long resolvers should cache “no such record” answers.
CAA records
A CAA record lists the certificate authorities allowed to issue TLS certificates for a domain. Certificate authorities must check it before they issue one (RFC 8659). If a domain has no CAA record, any certificate authority may issue for it.
SRV and NAPTR records
An SRV record gives the host and port for a named service, such as _sip._tcp.example.com, with a priority and a weight for load balancing. NAPTR records hold rewrite rules and are used mostly in telephony, for SIP and ENUM.
PTR records
PTR records power reverse DNS: they map an IP address back to a hostname. They live in special zones, in-addr.arpa for IPv4 and ip6.arpa for IPv6, controlled by whoever holds the address block, usually a hosting provider or ISP. Mail servers often check them. Try the reverse DNS lookup.
DS and DNSKEY records
These two records make DNSSEC work. DNSKEY records in the domain’s zone hold the public keys that sign its records. The DS record, published in the parent zone through your registrar, holds a hash of the domain’s key-signing key and links the parent to the domain. If the DS record and the keys stop matching, validating resolvers refuse to answer for the domain. Check a domain with the DNSSEC checker.
What is TTL?
TTL (time to live) is the number of seconds a resolver may keep a record in its cache. A TTL of 300 means five minutes and 86400 means one day. Short TTLs make changes visible sooner but send more queries to your nameservers. The DNS propagation guide explains how TTL affects changes.
How to read a record
In a zone file, a record is one line with five parts: www 3600 IN A 192.0.2.10. The parts are the name, the TTL in seconds, the class, the type and the value. The class is always IN, for internet. DNS control panels show the same parts as form fields and usually hide the class.
Two conventions cause confusion. The symbol @ stands for the domain itself. And in a zone file, a hostname that ends with a dot is complete, while one without a dot has the domain added to it. Writing mail.example.com without the final dot in the wrong place produces mail.example.com.example.com.
Records on the domain and on subdomains
Every name has its own set of records. The records for example.com say nothing about www.example.com, and each needs its own A, AAAA or CNAME record to resolve.
A wildcard record, written with an asterisk as the name, answers for any subdomain that has no records of its own. It is useful for services that create subdomains on demand. A wildcard never overrides a name that exists, so adding a record for shop.example.com takes that name out of the wildcard’s reach.
Which record do I need?
- To point the domain at a web server: an A record, and an AAAA record if the server has an IPv6 address.
- To point www or another subdomain at a hosting platform: a CNAME record to the name the platform gives you.
- To receive email: MX records naming your mail provider’s servers.
- To authorize services to send email: a TXT record for SPF, the DKIM records your provider supplies and a TXT record for DMARC.
- To prove you own the domain to a service: a TXT record, or sometimes a CNAME, with the value the service gives you.
- To limit who can issue certificates: a CAA record.
- To move DNS to another provider: new NS records, set at your registrar.
Common mistakes
- Putting a CNAME on the domain itself. Use an A record there, or the provider’s ALIAS feature.
- Pointing an MX record at an IP address or at a CNAME.
- Publishing two SPF records where one combined record is needed.
- Adding a verification record to the wrong name, such as the root when the service asked for a subdomain.
- Leaving old records in place after moving a service, so that some traffic still goes to the old server.
- Keeping a long TTL on a record you are about to change.
Common questions
Can a name have both a CNAME and other records?
No. A CNAME must be the only record at its name. That rule is why a CNAME cannot sit on the domain itself, which already has NS and SOA records.
What is the difference between an A record and a CNAME?
An A record points a name directly at an IP address. A CNAME points a name at another name and lets that name’s records supply the address. Use a CNAME when a provider may change its addresses.
Do I need an AAAA record?
Only if your server has a working IPv6 address. An AAAA record that points to an address that does not respond makes the site slow or unreachable for visitors on IPv6.
Which record proves I own a domain?
Usually a TXT record containing a code from the service that asks for proof. Some services ask for a CNAME, and certificate authorities can also check a file on the website.
Where do I edit DNS records?
At the company that runs the domain’s nameservers. That may be the registrar, the web host or a separate DNS provider. A nameserver lookup shows which.
How many records can a domain have?
The DNS sets no practical limit. Providers may cap the number on cheaper plans.