What Each Record Holds
example.com. 3600 IN A 203.0.113.10
www.example.com. 3600 IN CNAME example.com.
shop.example.com. 3600 IN CNAME stores.example.net.The A record answers with an address. The CNAME, canonical name, answers "this name is an alias; ask for that one instead", and the resolver follows the chain until it reaches an A or AAAA record. AAAA is the IPv6 counterpart of A. The other record types are covered in DNS record types.
Side by Side
| A record | CNAME | |
|---|---|---|
| Points to | An IPv4 address | Another name |
| Allowed at the apex | Yes | No |
| Other records beside it | Yes | No |
| Extra lookup | No | Sometimes |
| Follows target changes | No | Yes |
No CNAME at the Zone Apex
The apex is the bare domain, example.com itself. It always carries SOA and NS records, and the DNS standard does not allow a CNAME to share a name with any other record. So the apex cannot be a CNAME: example.com needs an A record, and AAAA if you use IPv6. Most DNS hosts refuse to save an apex CNAME; where one is accepted anyway, mail and delegation for the domain can break.
A CNAME Stands Alone
The same rule applies to every name. If www is a CNAME, it can have no MX, TXT, or A record of its own. A common trap is adding a TXT record for domain verification to a name that is already a CNAME: the DNS host refuses it, or resolvers never see it. Also, MX and NS records must name a host that has its own A or AAAA record, never a CNAME.
The Extra Lookup
When a CNAME points into another domain, a resolver with an empty cache may need one more query to get the address. Resolvers cache both records, so on a busy name the delay is rarely noticeable. Chains of CNAMEs pointing to more CNAMEs add up, though; keep it to one step where you can. Each record in the chain has its own TTL.
ALIAS Records and CNAME Flattening
To point a bare domain at a service that only gives you a host name, some DNS hosts offer a record called ALIAS or ANAME, or CNAME flattening, as Cloudflare calls it. The DNS host looks up the target itself and answers with the resulting addresses as A and AAAA records, so the apex rule is kept. It is a feature of the DNS host, not a standard record type, and works only while your zone is hosted there.
When to Use Which
| Name | Use |
|---|---|
| Bare domain | A and AAAA, or ALIAS |
| www | CNAME to the bare domain, or A |
| Your own server | A |
| CDN or hosted service | CNAME to the name they give |
| Mail host in an MX record | A |
With www as a CNAME of the bare domain, you change the address in one place when the server moves. A CDN or hosted service gives you its own name as the CNAME target, so it can change its addresses without asking you.
Check with dig
dig +short example.com A
dig +short www.example.comFor a CNAME, the short output prints the chain, normally the target name first and then the address. To see the record type and TTL as well:
dig www.example.com +noall +answerThe dig command guide covers the other options. After a change, resolvers may keep the old answer until its TTL runs out; see DNS propagation.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations