If you have ever set up a website or pointed a subdomain to a third-party service, you have almost certainly encountered two DNS record types: the A record and the CNAME record. They both help route traffic to the right place, but they work in fundamentally different ways -- and choosing the wrong one can lead to downtime, email problems, or confusing configuration errors.
This guide breaks down what each record does, when to use one over the other, and the most common mistakes to avoid.
What Is an A Record?
An A record is the most basic building block of DNS. It maps a domain name directly to an IP address -- specifically, an IPv4 address like 93.184.216.34. When a browser needs to load example.com, it queries DNS for the A record and gets back the numeric address of the server that hosts that website.
A records are direct. They say, "This name equals this address." There is no indirection or aliasing involved. You can also have multiple A records on a single domain name to distribute traffic across several servers.
If you need to support IPv6 as well, you would add an AAAA record alongside your A record. It works the same way but maps to the longer IPv6 address format.
What Is a CNAME Record?
A CNAME record works differently. Instead of pointing a name to an IP address, it points a name to another name. CNAME stands for "Canonical Name," and it essentially creates an alias. When a DNS resolver encounters a CNAME, it follows the chain and looks up the target name to find the final IP address.
For example, you might create a CNAME that points blog.example.com to mysite.hostingplatform.com. The resolver sees the CNAME, then looks up the A record for mysite.hostingplatform.com to get the actual IP address. This extra step happens behind the scenes and is invisible to visitors.
CNAMEs are especially useful when you do not control the destination server's IP address, or when that address might change. Since the CNAME just points to another name, any IP changes on the target side are picked up automatically without you touching your own DNS.
Key Differences at a Glance
Understanding a few core differences will help you make the right choice every time:
- What they point to. An A record points to an IP address. A CNAME points to another domain name.
- Where they can be used. A records can be used at any level of your domain, including the root (also called the apex or naked domain, like
example.com). CNAME records cannot be placed at the root -- they can only be used on subdomains likewww.example.comorshop.example.com. - Coexistence with other records. An A record can live alongside MX records, TXT records, and other record types on the same name. A CNAME cannot coexist with any other record type at the same name. This is a strict rule in the DNS specification and is the source of many configuration headaches.
- Resolution speed. A records resolve in a single lookup. CNAME records require at least two lookups -- one to follow the alias and another to resolve the final IP address. In practice, this difference is usually negligible thanks to DNS caching and low TTL values, but it is worth knowing.
When to Use an A Record
Reach for an A record when:
- You are configuring the root domain. Since CNAMEs are not allowed at the root, an A record is the standard way to point
example.comat your web server. Some DNS providers offer proprietary workarounds (often called ALIAS or ANAME records), but the A record remains the universal solution. - You know the IP address and it is stable. If you run your own server or your hosting provider gives you a static IP, an A record is the simplest and most direct option.
- You need other record types at the same name. Because A records can coexist with MX, TXT, and other record types, they are the safe choice when you also need email or domain verification records on the same name.
When to Use a CNAME Record
A CNAME is the better choice when:
- You are pointing a subdomain to a third-party service. Hosting platforms, CDN providers, and SaaS tools almost always ask you to create a CNAME. This is because their infrastructure may change IP addresses over time, and the CNAME ensures your subdomain automatically follows those changes.
- You want the
wwwversion to follow the root domain. A very common pattern is to set an A record onexample.comand a CNAME onwww.example.comthat points toexample.com. This way, both addresses resolve correctly without you having to manage two separate A records. - You do not want to track IP address changes. If the destination server's IP address is outside your control -- which is the case with most cloud services -- a CNAME saves you from having to monitor and update A records whenever the provider makes infrastructure changes.
Common Mistakes to Avoid
A handful of mistakes come up again and again when people configure A records and CNAMEs. Knowing about them in advance can save you a lot of troubleshooting time.
Placing a CNAME at the root domain. This is probably the most frequent error. If you try to add a CNAME on example.com itself, it will conflict with your SOA and NS records (which must exist at the root) and can break email delivery, DNS resolution, or both. Always use an A record at the root.
Adding other records alongside a CNAME. A CNAME must be the only record at its name. If you add MX or TXT records on shop.example.com and also have a CNAME there, the results are unpredictable. Some DNS providers will block this, but others silently allow it and cause hard-to-diagnose problems.
Chaining too many CNAMEs. It is technically possible to have a CNAME point to another CNAME, but long chains add latency and increase the chance of resolution failures. Keep chains short -- ideally one hop to a name that has an A record.
Forgetting about TTL during migrations. If you switch from an A record to a CNAME (or vice versa), the old record may still be cached by resolvers around the world. Lowering the TTL well in advance gives caches time to expire so the new record takes effect faster. A TTL of 300 seconds (five minutes) is a common pre-migration choice.
Choosing the Right Record
The decision between an A record and a CNAME usually comes down to two questions: Are you configuring the root domain or a subdomain? And do you have a fixed IP address or are you pointing to another hostname? For the root domain, use an A record. For subdomains that need to follow a third-party service, use a CNAME. Keep that simple rule in mind and you will get it right in the vast majority of situations.
If you want to check what records are currently set on any domain, try our DNS lookup tool. It shows A records, CNAMEs, and everything else in one place -- a quick way to verify a new record or diagnose why something is not resolving the way you expect.

