CNAME record
A CNAME record lets DNS look up information for one name by using another name, called its alias target. CNAME stands for “canonical name,” meaning the target name that DNS should continue looking up. A CNAME does not point directly to an IP address; it points to a different domain or host name, whose own DNS records provide the next answer.
How does a CNAME work?
Suppose shop.example.com has a CNAME record pointing to store.example.net. When a browser needs an address for shop.example.com, DNS returns the alias and follows the target name's records. If store.example.net has an A record, that record can provide an IPv4 address for the next step. The CNAME is a DNS alias, not a web redirect: the browser's address bar remains shop.example.com unless the website separately sends an HTTP redirect.
When is CNAME different from a redirect?
A CNAME changes how DNS finds information for a name. A web redirect is an instruction sent after a browser connects to a web server; it can send the browser to a different URL and change what appears in the address bar. For example, a CNAME can make www.example.com resolve through a provider's target name, while an HTTP redirect can send a visitor from example.com to www.example.com.
What limits apply to CNAME records?
Under the DNS rules, a name with a CNAME generally cannot also have other ordinary DNS data at that same name. This is why a CNAME is not normally used at a zone's root name, the name at the top of that managed part of DNS. Records such as SOA and NS must exist there. Some DNS providers offer special features called flattening or aliases at the root, but those are provider-specific behaviors and are not ordinary CNAME records.
A CNAME also does not create the target service. If store.example.net has no usable address or the service is unavailable, the alias does not fix that. For the underlying record types, see DNS records.
Related terms
- DNS record — explains the general role of a record
- Redirect — a web instruction that can change the visitor's URL
- Subdomain — a name such as
shop.example.combeneath a domain