CNAME Record
DNSCNAME Record is a DNS record type that maps one hostname (an alias) to another hostname (the canonical name) instead of to an IP address. It lets multiple names point to the same destination and follow changes automatically when the target host changes. CNAMEs are commonly used for subdomains and third party services, but they cannot coexist with other records at the same name.
How It Works
A CNAME (Canonical Name) record tells DNS resolvers that a hostname is an alias for another hostname. When a user requests the alias (for example, blog.example.com), the resolver receives the CNAME response and then performs an additional lookup for the target name (for example, example-hosting.net) to obtain the final A/AAAA record and IP address.
Because the alias ultimately depends on the target hostname, changes to the target's underlying IP addresses are picked up automatically without editing the alias record. A key rule is that a CNAME must be the only record at that exact name: you cannot have a CNAME at a hostname that also has other record types like A, AAAA, MX, or TXT. Many DNS providers also restrict using CNAME at the zone apex (the root domain), which is why ALIAS or ANAME records exist as alternatives.
Why It Matters for Web Hosting
CNAME records affect how you connect domains and subdomains to hosting platforms, CDNs, and managed services. When comparing hosting plans or setups, you often need to decide whether to point a name directly to an IP (A/AAAA) or to a provider-managed hostname (CNAME) for easier migrations and load balancing. Understanding CNAME limitations also prevents common mistakes, such as trying to place a CNAME on the root domain while still needing MX or TXT records for email and verification.
Common Use Cases
- Pointing a subdomain (www, blog, shop) to a hosting platform hostname that may change behind the scenes
- Connecting a domain to a CDN edge hostname for caching and traffic acceleration
- Mapping service-specific subdomains to SaaS endpoints (email marketing, helpdesk, status pages)
- Keeping multiple subdomains aligned to one canonical host without duplicating A/AAAA records
- Supporting blue-green deployments by switching the CNAME target to a new hostname during cutovers
CNAME Record vs A Record
An A record maps a hostname directly to an IPv4 address (and an AAAA record maps to IPv6), while a CNAME maps a hostname to another hostname that then resolves to addresses. A/AAAA can be faster to resolve and work cleanly at the root domain, but they require you to update IPs if the destination changes. CNAME is more flexible for provider-managed endpoints, but it adds an extra DNS lookup and cannot share the same name with other record types.