What is a CNAME Record?
A CNAME (Canonical Name) record is a type of DNS record that creates an alias from one domain name to another. Instead of mapping to an IP address like an A record, a CNAME points one domain to another domain, which then resolves to an IP address.
How Does CNAME Record Work?
CNAME records are commonly used to point subdomains to other domains. For example, you might create a CNAME record for www.example.com that points to example.com, or for blog.example.com that points to your-blog.hosting-platform.com. The DNS resolver follows the chain: it looks up the CNAME, finds the target domain, then resolves that domain's A record to get the final IP address.
There are important restrictions on CNAME records. A CNAME cannot coexist with other record types for the same name, and you cannot place a CNAME on the root domain (example.com) per the DNS specification. Many DNS providers offer workarounds like ALIAS or ANAME records that function similarly to CNAMEs but work at the root level. CNAME records are essential when using services like CDNs, load balancers, or hosted platforms that may change their underlying IP addresses.