CNAME Record
Also known as: Canonical name record, CNAME, DNS alias
A DNS record that makes one domain name an alias of another. A lookup of the alias follows the CNAME to the target name and returns the target's addresses.
Last updated:
What is a CNAME record?
A CNAME record (canonical name record) makes one name an alias of another. When a resolver looks up a name that has a CNAME, it does not get an address. It gets the other name, the canonical one, and looks that up instead. The CNAME type is one of the original record types in RFC 1035.
Two real CNAME records, as dig returned them on 12 November 2026:
dig +noall +answer www.github.com CNAME
www.github.com. 3600 IN CNAME github.com.
dig +noall +answer www.microsoft.com CNAME
www.microsoft.com. 3600 IN CNAME www.microsoft.com-c-3.edgekey.net.
The first is the simplest use: www.github.com is an alias of github.com, so both always resolve to the same addresses. The second shows the most common use on big sites: www.microsoft.com points into a CDN's domain (edgekey.net), and the CDN decides which of its servers answers.
When to use a CNAME
A CNAME is the right choice when someone else controls the address. CDNs, website builders, hosted shops and email marketing services all ask customers to point a name such as www or shop at a name of theirs. They can then move their servers and change IP addresses without customers editing anything. An A record is the right choice when you control the server and its address.
The rules a CNAME has to follow
- Nothing else at the same name. A name with a CNAME cannot hold any other record (apart from DNSSEC signatures), as RFC 1034 and RFC 2181 require. That is why there is no CNAME at a domain's root: the root must have NS and SOA records. DNS hosts that offer "CNAME flattening", ALIAS or ANAME work around it by resolving the target themselves and answering with A records.
- MX and NS records must not point at one. An MX record has to name a host with its own address record, not an alias (RFC 2181, section 10.3).
- It is not a redirect. The browser still requests the original name; only the address it connects to changes. Moving visitors from one URL to another is an HTTP redirect, made on the web server.
How to look up a CNAME
Our DNS lookup tool queries the CNAME record along with A, AAAA, MX, TXT and the others. From a terminal, run dig CNAME www.example.com on macOS or Linux, or nslookup -type=cname www.example.com on Windows. Ask for the exact name: a CNAME on www.example.com says nothing about example.com.
When the A record you look up comes back with addresses you do not recognise, a CNAME is often the reason, and the chain tells you whose network actually serves the site. Running one of those addresses through the IP lookup shows the network that owns it.