Module 2: DNSLesson 6 of 136 min read
DNS record types explained: A, AAAA, CNAME, MX, TXT and more
A domain's DNS settings are a list of records. Each one answers a single kind of question: where is the website, where should mail go, which servers are in charge, which text proves ownership. The record type says which question. Reading records is mostly a matter of knowing what each type's value means and the few rules that cause trouble when they are broken.
The shape of every record
RFC 1035 defines a resource record as an owner name, a type, a class (almost always IN, for internet), a TTL and the type-specific data. Written in the usual zone-file style, a record reads left to right like this: www.example.com. 3600 IN A 192.0.2.10. The TTL, 3600 here, is how many seconds resolvers may cache it.
Cloudflare's guide describes records as instructions held on authoritative DNS servers. A lookup asks for one name and one type, so asking for the A record of example.com tells you nothing about its MX records.
The everyday types
These are the records almost every domain has or needs, with what their value contains:
- A: an IPv4 address, for example 192.0.2.10.
- AAAA: an IPv6 address, for example 2001:db8::10.
- CNAME: another name. The name is an alias, and resolvers continue with the target, called the canonical name. It never holds an address itself.
- MX: a mail server for the domain, with a preference number. RFC 1035 defines the preference as a 16-bit integer where lower values are preferred.
- TXT: free text. Cloudflare notes it is often used for email security; SPF, DKIM and DMARC records are all TXT records.
- NS: the authoritative name servers for the zone.
- SOA: the start of authority: the zone's primary server, admin contact, serial number and timers that tell secondary servers how often to refresh their copy.
Specialised types worth recognising
Cloudflare also lists several less common types. Three show up often in lookups:
- PTR: the reverse of an A record. It maps an address back to a name and is used in reverse lookups, such as finding the host name behind 192.0.2.10.
- SRV: a host and port for a specific service, so clients can find a server without a fixed port.
- CAA: names the certificate authorities allowed to issue certificates for the domain. Cloudflare's guide notes that without a CAA record any CA may issue, and that the records are inherited by subdomains.
The CNAME rule
RFC 1034 states that if a CNAME record is present at a name, no other data should be present there. The reason is consistency: the alias and its target must not give different answers, and a cached CNAME can then be used for any type of question.
This has a practical consequence. The bare domain, example.com, must have NS and SOA records, so a standard CNAME cannot sit at the zone's apex. That is why www.example.com is commonly the CNAME while example.com itself uses A and AAAA records.
A common mistake
Adding a TXT record for domain verification at a name that already has a CNAME breaks the rule above, and the TXT record may never be seen: a resolver that already has the CNAME cached follows it to the target and asks there instead. Put the TXT record on a name without a CNAME.
Worked example: reading one zone
Here is a small zone for example.com, as a lookup tool would show each record type:
- example.com A 192.0.2.10 and example.com AAAA 2001:db8::10: the website over IPv4 and IPv6.
- www.example.com CNAME example.com: www is an alias, so it ends up at the same two addresses.
- example.com MX 10 mx1.example.net and example.com MX 20 mx2.example.net: senders try mx1 first, because 10 is lower than 20, and use mx2 if mx1 fails.
- example.com TXT "v=spf1 include:_spf.example.net -all": the domain's SPF policy.
- example.com NS ns1.example.net and ns2.example.net: the servers that hold all of the above.
What an MX lookup returns, and what it doesn't
An MX query for example.com returns the two lines with preference 10 and 20 and the two host names. It does not return their IP addresses; a sender looks those up next with A and AAAA queries for mx1.example.net and mx2.example.net.
Look up the mail servers of a real domain. The tool opens with Record type set to MX: compare the preference numbers in the Value column and see which server senders try first. Then switch Record type to TXT, NS or CAA for the same Domain name.
DNS lookupQuick check
Three questions. Pick an answer to see why.
A domain has MX 10 mx-a.example.net and MX 5 mx-b.example.net. Which server do senders try first?
Show the answer
Answer: mx-b, because 5 is lower than 10 RFC 1035 defines MX preference so that lower values are preferred.
Why can't you normally put a CNAME on the bare domain example.com?
Show the answer
Answer: The bare domain needs NS and SOA records, and a CNAME may not share its name with other data RFC 1034 says no other data should be present at a name with a CNAME, and the zone apex always has NS and SOA.
Which record type would you check to see if a domain allows a given certificate authority to issue certificates?
Show the answer
Answer: CAA A CAA record names the CAs allowed to issue for the domain; without one, any CA may issue.
Standards, not guesses
These guides explain how the internet's plumbing works, using the published standards (RFCs) and official documentation. Each guide shows the date it was last checked.
Sources
- RFC 1035: Domain Names – Implementation and Specification
- RFC 1034: Domain Names – Concepts and Facilities
- Cloudflare Learning Center – DNS records
Last checked October 28, 2026