In plain English A domain setting that says "this name is just another name for that one". For example, www pointing at the main domain.
A CNAME record makes one name an alias of another. www.example.com CNAME example.com means “to find www, look up whatever example.com points to”. The resolver follows the alias and returns the final address. CNAME stands for canonical name.
Why use one
When the target’s address changes, every alias follows automatically, so there is one record to update instead of many. Services such as CDNsCDN A network of servers around the world that keep copies of your site’s files, so each visitor gets them from somewhere nearby. Faster pages, less work for your server. More about CDN →, website builders and email platforms often ask you to create a CNAME pointing at a hostname they control, so they can change their own IP addresses freely.
| Name | Type | Value |
|---|---|---|
www | CNAME | example.com. |
shop | CNAME | shops.myplatform.example. |
The two rules
- A name with a CNAME cannot have any other record. You cannot have a CNAME and a TXT recordTXT record A domain setting that holds a line of text. Services use it to check you own the domain, and email uses it for SPF, DKIM and DMARC. More about TXT record → on
www, for example. - The bare domain cannot be a CNAME, because it must also hold NS and SOA records. Some DNSDNS The internet’s phone book. It turns a name people can remember, like example.com, into the number address computers use to find the server. More about DNS → providers offer “CNAME flattening” or ALIAS records, which behave like a CNAME at the bare domain by looking up the target and answering with its address.
Also, never point MX or NS records at a name that is a CNAME. Check where a CNAME leads with:
dig www.example.com +short
The answer lists the alias target followed by its address.
Questions people ask
What is a CNAME example?
www.example.com CNAME example.com sends visitors of the www address to wherever the bare domain points. A CDN might ask for assets.example.com CNAME example.cdnprovider.example.
CNAME or A record: which should I use?
Use an A record when you have an IP addressIP address The number address of a device on the internet, like 203.0.113.10. Computers use it to find each other, the way post uses street addresses. More about IP address → to point at. Use a CNAME when a service gives you a hostname instead, so they can change their addresses without you editing DNS. See DNS record types explained.