CNAME Record Explained: What It Is & How to Use It for Subdomains
what a DNS CNAME record does, when to use it (www subdomain, third‑party services), and how to check CNAME entries with free tools.
What Is a CNAME Record?
A CNAME (Canonical Name) record is a type of DNS record that maps one domain name (an alias) to another domain name (the canonical name). Instead of pointing directly to an IP address, a CNAME points to another domain, which in turn has its own A or AAAA record.
For example, you can set www.example.com as a CNAME pointing to example.com. When someone visits www.example.com, the DNS resolver follows the CNAME and looks up the A record of example.com.
When Should You Use a CNAME Record?
CNAMEs are extremely useful in several scenarios:
1. WWW to Non‑WWW (or vice versa)
Most websites choose either example.com (naked domain) or www.example.com as their primary. The other version can be a CNAME pointing to the primary. This ensures both URLs work and users aren’t penalised for duplicate content.
2. Subdomains Pointing to External Services
If you use a third‑party platform (Shopify, GitHub Pages, a CDN), you often create a CNAME from a subdomain like shop.example.com to their server name (e.g., shops.myshopify.com). This hides the external provider from visitors.
3. Load Balancing or CDN Aliases
Many CDNs and load balancers give you a generic hostname. You can create a CNAME from your subdomain to their hostname, and they manage the underlying IPs.
CNAME vs A Record: What’s the Difference?
- A record maps a domain directly to an IPv4 address (e.g.,
192.0.2.1). - CNAME record maps a domain to another domain name (e.g.,
www.example.com → example.com).
You cannot have a CNAME record at the root (apex) of your domain (e.g., example.com itself) because the zone’s start of authority (SOA) and name server (NS) records conflict. Most providers allow only A/AAAA records at the apex.
How to Check CNAME Records for Any Domain
Use our free DNS Checker Tool to see CNAME records:
👉 Check CNAME Records for Free
Select “CNAME” record type and enter the domain (e.g., www.example.com). The tool will display the canonical name and TTL. You can also choose “ALL” to see all records at once.
Common CNAME Mistakes & How to Avoid Them
Using CNAME at the Apex (Root Domain)
Many DNS providers do not allow example.com (without a subdomain) to be a CNAME. It violates DNS standards because the root must have SOA and NS records. Fix: Use an A record at the apex, or use an “ANAME” / “ALIAS” record if your provider supports it.
Chaining CNAMEs Too Long
Technically, you can chain CNAMEs (e.g., a → b → c → d). But each extra step adds latency. Keep chains short, ideally just one level.
Creating a CNAME That Points to Another CNAME
While allowed, it’s inefficient and can cause resolution delays. Always point CNAMEs directly to an A/AAAA record or a stable hostname (not another CNAME).
Forgetting to Update the Target Record
If the canonical domain’s A record changes, your CNAME automatically follows – that’s a benefit. But if you delete the target record, the CNAME will break. Always keep the target alive.
External Resources for Advanced DNS Management
For deeper dives into DNS architecture and troubleshooting, these external sites offer valuable guides:
- woorldtv.com – video tutorials on DNS record management and CNAME configuration examples.
- cartpostal.net – printable DNS record templates and subdomain planning worksheets.
Frequently Asked Questions (FAQ)
Can I use a CNAME for email services (MX record)?
No. MX records must point directly to a hostname that resolves to an IP. CNAMEs are not allowed in MX records according to RFC standards. Use A records or the direct hostname.
How long does it take for a CNAME change to propagate?
Up to the TTL value (usually 1‑24 hours). Lower the TTL in advance if you anticipate changes.
What happens if I delete a CNAME’s target domain?
The alias will stop resolving. Browsers will show “DNS error” or “Server not found”. Always verify the target exists.
Can I point a CNAME to an external domain I don’t own?
Technically yes, but it’s risky. If the external domain changes its DNS or goes away, your alias breaks. Only point to domains you control or trusted services.
How do I test a CNAME before changing DNS?
Use our DNS Checker to query the CNAME directly. You can also use command line: dig CNAME www.example.com or nslookup -type=CNAME www.example.com.
Set Up Your CNAME Records Correctly
Adding a CNAME is straightforward: log into your DNS provider, add a new record of type CNAME, enter the subdomain (e.g., www), and the target (e.g., example.com). Wait for propagation, then verify with our DNS Checker. Proper use of CNAMEs makes your domain flexible and future‑proof.