CNAME vs A Record: Which DNS Record Should You Use?
Confused by CNAME vs A Record? Learn the key difference in seconds. An A record points to an IP, a CNAME points to another domain. We'll show you when to use each.
The Simple Answer: IP Address vs. Domain Name
The difference between a CNAME and an A record is straightforward: An A record points a domain name directly to a specific IP address (like 192.0.2.1), while a CNAME record points a domain name to another domain name, not an IP address. Think of the A record as the final destination address for your website's server, providing a direct, unchanging map. It's the fundamental building block of your DNS configuration.
A CNAME, or Canonical Name, acts more like a forwarding address or an alias. Instead of providing its own IP address, it simply says, 'Look at this other domain name for the correct IP address.' This is incredibly useful for flexibility, as you can point a subdomain to a service, and if that service ever changes its IP address, your record automatically updates because it's just pointing to their domain name.
When to Use an A Record (The Foundation)
You should always use an A record for pointing your root domain (also called an apex domain, like `yourdomain.com`) to your web server. This is a strict rule in the DNS system. Using a CNAME on a root domain is invalid and can break other essential services associated with your domain, such as your email (MX records). An A record provides the stable, authoritative link between your primary domain name and the server that hosts it.
A records are also the best choice for any critical infrastructure you control directly. For example, subdomains like `mail.yourdomain.com` or `ftp.yourdomain.com` that point to specific services on your own server should use A records. Since you control the server's IP address, creating a direct link is more efficient and avoids the tiny performance overhead that comes with the extra lookup required by a CNAME.
When to Use a CNAME Record (The Flexible Alias)
CNAME records are perfect for pointing subdomains to third-party services that you don't personally manage. A classic example is setting up a blog on a platform like Ghost or a store on Shopify. You might point `blog.yourdomain.com` to `your-username.ghost.io` or `shop.yourdomain.com` to `shops.myshopify.com`. This way, Shopify can manage its own server infrastructure and change IP addresses as needed without you ever having to update your DNS records.
Another common use for CNAMEs is with Content Delivery Networks (CDNs). When you set up a CDN, you often point a subdomain like `cdn.yourdomain.com` to a unique hostname provided by the CDN, such as `d1234abcd.cloudfront.net`. This allows the CDN to dynamically route user requests to the nearest server for faster content delivery. Using a CNAME here is essential for the service to function correctly.
Common Mistakes and Best Practices
The most critical mistake is attempting to place a CNAME record on your root domain. We've said it before, but it bears repeating: it will not work as expected and will conflict with other crucial records like MX (for email) and NS (nameserver) records. Your root domain must have an A record (or AAAA for IPv6) pointing to your server's IP address.
A second point of confusion is CNAME chaining. While technically possible to point a CNAME to another CNAME, it is poor practice. Each CNAME in the chain adds an extra DNS lookup, which slows down your website's load time for first-time visitors. Aim to have your CNAMEs point directly to a target domain that resolves with an A record for the best performance.
Finally, always double-check your work. After making DNS changes, use an online tool like `dnschecker.org` or the command line utility `dig` to verify that your records are propagating correctly. Remember that DNS changes aren't instant and can take some time to be visible everywhere, a process known as propagation.
Questions readers ask about this topic
Can I use a CNAME for my main domain (e.g., mydomain.com)?
Which is better for SEO, a CNAME or an A Record?
How do I point a domain to my hosting without an IP address?
Can a subdomain have a CNAME and other records at the same time?
Where to go next on Hostilo
One email a month. Hosting deals, new reviews, no fluff.
How to choose web hosting in 2026
A calm, decision-first framework for picking hosting without falling for marketing claims or coupon-site noise.
Shared vs VPS vs cloud hosting, explained simply
The plain-language version of the comparison most articles overcomplicate — with practical recommendations by site type.