What is a CNAME record?
A CNAME record makes one name an alias of another. A resolver that finds a CNAME starts over with the target name and returns that name's addresses.
CNAMEs are how you point a subdomain at a hosting service or CDN without knowing its IP addresses: the provider can change addresses and your record stays correct.
How to read a CNAME record
In a zone file, the record looks like this:
www.example.com. 3600 IN CNAME example.com.
- The alias: the name people type.
- The TTL in seconds.
- The target (canonical name) the alias points to.
From the command line
Look up CNAME records without this site.
On macOS and Linux, use dig:
dig example.com CNAME +short
On Windows, use nslookup:
nslookup -type=CNAME example.com
To skip caches, ask one of the domain’s nameservers directly: dig @ns1.example.net example.com CNAME. The “Its own nameservers” option on the result page does the same.
Questions and answers
Why does my root domain show no CNAME?
A bare domain cannot have a CNAME, because a CNAME must be the only record at its name and the root always has SOA and NS records. Look up the www name instead.
Can a CNAME point to another CNAME?
Yes, but each hop costs an extra lookup. Keep chains short, and never point an MX or NS record at a CNAME.
Can a name have a CNAME and a TXT record?
No. A CNAME excludes every other record type at the same name. Put the TXT record on the target name instead.