What is cname
Last updated: April 1, 2026
Key Facts
- CNAME stands for Canonical Name, and it allows a domain to point to another domain instead of directly to an IP address
- CNAME records are commonly used to point subdomains (like www.example.com or blog.example.com) to different hosting services or CDNs
- You cannot create a CNAME record for the root domain (example.com), only for subdomains; use A or AAAA records for the root instead
- CNAME records work by performing DNS lookups on the target domain, so changes to the target domain's IP address automatically reflect for the CNAME
- Email services often use CNAME records to allow users to point their domains to external mail servers without managing direct IP configurations
Understanding CNAME Records
A CNAME (Canonical Name) record is a type of Domain Name System (DNS) resource record that creates an alias for a domain name. Instead of pointing directly to an IP address like A records do, CNAME records point to another domain name. This creates an alias relationship where one domain name becomes an alternative name for another domain.
When a DNS query encounters a CNAME record, it performs an additional DNS lookup on the target domain to find the actual IP address. This means CNAME records provide an indirect routing mechanism in DNS infrastructure, allowing flexibility in domain management.
How CNAME Records Work
When you create a CNAME record, you specify a source domain (typically a subdomain) and a target domain. For example, you might create a CNAME record pointing blog.example.com to blog.example.com.cdn.provider.com. When someone accesses blog.example.com, their DNS resolver follows the CNAME record and looks up the target domain, eventually finding the IP address that provides the content.
This structure allows multiple domains or subdomains to point to the same service without duplicating configuration. If the target domain's IP address changes, all CNAME records pointing to it automatically resolve to the new address, eliminating the need for manual updates.
Common Use Cases
CNAME records are extensively used for Content Delivery Networks (CDNs) like Cloudflare, Akamai, and CloudFront. Websites point subdomains to CDN endpoints using CNAME records, allowing the CDN to serve cached content globally. Email hosting providers use CNAME records to allow users to point their domains to external mail servers. Software-as-a-Service (SaaS) platforms often require customers to create CNAME records pointing to their service, enabling custom domain functionality.
CNAME Limitations and Best Practices
Important limitations include that CNAME records cannot be created for root domains (the bare domain without a subdomain prefix). Only subdomains can have CNAME records; the root domain must use A or AAAA records. Additionally, a single DNS name cannot have both a CNAME record and other record types, preventing mixed configurations.
Best practices include using CNAME records only for subdomains and utilizing them for services that require indirection. Always document CNAME configurations for maintenance purposes, and be cautious of CNAME chains (multiple CNAME records pointing to each other), which can cause delays in DNS resolution.
Related Questions
What is the difference between A record and CNAME record?
A records point directly to an IP address, while CNAME records point to another domain name. A records can be used for root domains; CNAME records cannot. CNAME provides indirection and flexibility for managing multiple domains.
Can I use a CNAME for my root domain?
No, you cannot create a CNAME record for your root domain (example.com). You must use an A or AAAA record for the root. CNAME records are only allowed for subdomains.
How long do CNAME records take to propagate?
CNAME record propagation typically takes 24-48 hours globally as DNS changes spread across internet name servers. Some providers and locations may update faster within a few hours.
More What Is in Daily Life
Also in Daily Life
More "What Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Wikipedia - CNAME RecordCC-BY-SA-4.0
- RFC 1035 - Domain Names - Implementation and SpecificationPublic Domain