Skip to content

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.

Frequently Asked Questions

An A record maps a name straight to an IPv4 address. A CNAME maps a name to another name, and the resolver then looks that name up. Use an A record when you control the address; use a CNAME when someone else, such as a CDN or a hosted service, controls it and may change it, so your record keeps working.
No. The root (apex) of a domain must hold SOA and NS records, and a CNAME cannot share a name with any other record. Many DNS hosts offer a workaround under names such as ALIAS, ANAME or CNAME flattening, which follow the target behind the scenes and answer with plain A records.
Enter the name in our DNS lookup tool with CNAME selected, or run dig CNAME followed by the name on macOS or Linux, or nslookup -type=cname followed by the name on Windows. Look up the exact name, such as www.example.com: a CNAME on www does not exist on the bare domain.
Yes, and resolvers follow the chain, but every link adds a lookup and a point of failure. Large sites behind CDNs often have chains of two or three. A chain that loops back on itself fails to resolve.
In a zone file, a name without a final dot is treated as relative to the zone, so www pointing at example.net would become example.net.example.com. The trailing dot marks the name as complete. Most DNS hosting dashboards add it for you.
No. A CNAME only changes which server's address the name resolves to; the browser still asks for the original name, and the address bar does not change. Sending visitors from one URL to another needs an HTTP redirect on the web server.