www.example.com. 3600 IN CNAME example.com.
A CNAME record (canonical name) says “this name is an alias — look up that other name instead”. The resolver follows the chain and returns the target’s records along with the CNAME.
Rules
- A name with a CNAME cannot have any other records (RFC 1034). That’s why the apex of a domain, which needs SOA and NS records, can’t be a CNAME.
- CNAMEs can chain, but each hop costs a lookup. Keep chains short.
- MX and NS records must point to names that have A/AAAA records, not to CNAMEs.
Typical uses
Pointing www or a subdomain at a CDN or SaaS provider (shop.example.com CNAME shops.provider.net), so the provider can change addresses without you editing DNS.
Frequently asked questions
- Can I use a CNAME on my root domain?
- Not in standard DNS. Use A/AAAA records, or your DNS provider's ALIAS/ANAME/flattening feature which resolves the target for you.
- Does a CNAME affect email?
- Yes — a name with a CNAME can't also have MX or TXT records, so don't put a CNAME on a name that needs to receive mail.