CNAME
A CNAME record, short for Canonical Name record, is a type of DNS (Domain Name System) record that maps one domain name (an alias) to another domain name (the canonical or primary address). This record allows multiple subdomains, such as: www.example.com, shop.example.com, or mail.example.com to point to the same underlying server or service.
Instead of managing separate A records for every subdomain, administrators can maintain a single canonical domain and use CNAMEs to redirect traffic as needed. This streamlines DNS management, reduces configuration errors, and keeps domain data consistent across environments.
CNAME records are one of several essential DNS record types that keep the internet functional, alongside A, AAAA, MX, and TXT records.
How a CNAME Record Works
When a DNS resolver encounters a CNAME record, it understands that the requested domain is an alias for another domain name. The resolver then follows a two-step lookup process:
- User requests
www.example.com. - The DNS resolver finds a CNAME record pointing to example.com.
- The resolver performs another lookup to retrieve the A or AAAA record for example.com.
- The final IP address is returned to the user’s browser, which connects to the correct destination.
This chain of lookups makes CNAMEs flexible and efficient for managing subdomains or multi-site architectures. By centralizing control under a single canonical record, CNAMEs reduce the need for duplicate IP maintenance across multiple DNS entries.
Types of DNS Records
|
Record Type |
Function |
|
A Record |
Maps a domain name to an IPv4 address. |
|
AAAA Record |
Maps a domain name to an IPv6 address. |
|
CNAME Record |
Creates an alias pointing to another domain name. |
|
MX Record |
Routes email traffic to mail servers. |
|
TXT Record |
Stores text-based data for SPF, DKIM, and verification purposes. |
A CNAME record cannot coexist with other record types on the same hostname. For example, if blog.example.com uses a CNAME, it cannot also have an A, MX, or TXT record.
Benefits of Using CNAME Records
Simplified DNS Management:
Updates made to the canonical domain’s IP automatically propagate to all aliases, minimizing the risk of configuration drift.
Scalability:
CNAMEs make it easier to manage global or multi-subdomain architectures, especially for organizations expanding into international markets.
Flexibility:
They’re ideal for integrating external platforms such as SaaS tools, CDNs, and managed hosting services without exposing the provider’s IPs.
Resilience:
Centralized DNS control reduces the chance of outdated or mismatched DNS records across distributed systems.
Consistency:
Ensures every alias remains linked to the correct, current target domain, maintaining uptime and brand reliability.
Limitations of CNAME Records
While CNAMEs improve flexibility, they come with important constraints:
- No Mixed Records: A hostname with a CNAME cannot contain other record types like A, MX, or TXT.
- Extra Lookup Time: Because CNAMEs require a secondary DNS lookup, they introduce a minor latency.
- Potential Misconfiguration: Incorrect chains can create resolution loops or service outages.
- Root-Level Restriction: CNAMEs are not supported at the root domain level (e.g., example.com); alternatives like ALIAS or ANAME are used instead.
- DNSSEC Complexity: Long or poorly managed CNAME chains can complicate DNSSEC validation and increase failure points.
Compare: CNAME vs. A Record
|
Feature |
CNAME Record |
A Record |
|
Function |
Maps one domain name to another (alias). |
Maps a domain directly to an IP address. |
|
DNS Lookups |
Two lookups (alias → canonical → IP). |
One lookup (domain → IP). |
|
Common Use |
Subdomains pointing to the same destination. |
Defining the IP for the root domain. |
|
Flexibility |
Simplifies multi-domain management. |
Requires manual IP updates. |
|
Compatibility |
Not allowed at the root level. |
Works at any level. |
A records directly connect domains to IP addresses, while CNAME records act as pointers to another domain name. This makes CNAMEs more flexible but slightly slower due to the additional lookup.
Examples and Use Cases of CNAME Records
Real-World Examples
- Websites:
www.example.comis a CNAME forexample.com, ensuring both URLs serve the same website. - Email Services:
mail.example.compoints tomail.provider.comfor seamless integration with a third-party mail host. - Localization:
en.example.comandfr.example.comact as CNAMEs for CDN endpoints that host regional versions of a site.
CNAME Use Cases
- CDN Integration: Directs subdomains to CDN-managed servers for performance optimization.
- SaaS Applications: Maps branded subdomains (e.g., portal.company.com) to externally hosted platforms.
- Load Balancing and Failover: Allows administrators to dynamically route traffic to healthy endpoints.
- Email and Verification: Points subdomains to mail or verification services.
- Multi-Region Sites: Directs users to geographically appropriate servers.
- Testing and Staging: Simplifies switching between production and test environments without touching IP-level records.
Related Terms
Looking to Strengthen Your Network Foundation?
DNS clarity starts with understanding record types. Start your free trial of DNSFilter and experience simplified, intelligent DNS management built for performance and security.


