What Is a CNAME Record (Canonical Name)?
A CNAME record is a DNS record that maps one hostname to another, creating an alias. It allows multiple domain names to resolve to the same destination without duplicating IP configurations.
How CNAME Records Work
A CNAME record tells DNS resolvers that the queried hostname is an alias for another hostname (the canonical name). When a resolver encounters a CNAME, it follows the alias and performs a second lookup on the target hostname to find the actual IP address via an A record.
For example, if www.example.com has a CNAME pointing to example.com, then any request to www.example.com will resolve to whatever IP address example.com points to.
Why CNAME Records Matter
CNAME records simplify DNS management by letting you point multiple subdomains to a single canonical hostname. If the target IP changes, you only need to update one A record. CNAMEs are commonly used for www subdomains, CDN configurations, SaaS integrations, and email authentication (like DKIM selector records).
Frequently Asked Questions
Can I use a CNAME at the zone apex (root domain)?
No. The DNS specification prohibits CNAME records at the zone apex because a CNAME cannot coexist with other record types (like SOA and NS records). Some providers offer ALIAS or ANAME records as a workaround.
What is the difference between a CNAME and an A record?
An A record maps a hostname directly to an IP address, while a CNAME maps it to another hostname. Use A records for root domains and CNAMEs for subdomains that should point to another hostname.
Can a CNAME point to another CNAME?
Technically yes, but CNAME chains are discouraged. Each additional CNAME adds a DNS lookup and increases latency. Point CNAMEs directly to the final canonical hostname.