A Record vs CNAME: When to Use Each DNS Record Type
A records and CNAME records are the two most common DNS record types, but they work differently. A records map a domain directly to an IP address, while CNAMEs create an alias to another domain name. This guide explains when to use each and the important limitations to know.
Side-by-Side Comparison Table
| Feature | A Record | CNAME Record |
|---|---|---|
| Maps to | IPv4 address (e.g., 93.184.216.34) | Another domain name (alias) |
| Root domain use | Yes | No (RFC restriction) |
| DNS lookups required | 1 lookup | 2+ lookups (resolve chain) |
| IP change handling | Manual update required | Automatic (follows target) |
| Can coexist with other records | Yes | No (exclusive at name) |
| Common use case | Root domains, mail servers | Subdomains, CDNs, SaaS services |
A Records: Direct IP Mapping
An A record (Address record) maps a domain name directly to an IPv4 address. When a DNS resolver queries your domain, it gets the IP address in a single lookup. A records are the most fundamental DNS record type and can be used anywhere, including at the root domain (zone apex).
The downside of A records is that if the target server's IP changes, you must manually update the DNS record. For services behind load balancers or CDNs where IPs change frequently, this creates maintenance overhead. For IPv6 addresses, use an AAAA record instead.
Look up A records for any domain with our DNS Lookup tool.
CNAME Records: Domain Aliases
A CNAME record (Canonical Name) creates an alias from one domain name to another. Instead of pointing to an IP address, it points to a target domain. The DNS resolver follows the chain: first resolving the CNAME to its target, then resolving the target to an IP address.
CNAMEs are ideal for subdomains that point to external services. If the service changes its IP addresses, your CNAME automatically follows. However, a CNAME cannot coexist with other record types at the same name, and RFC 1034 prohibits CNAMEs at the zone apex (root domain).
Check CNAME records with our CNAME Lookup tool.
When to Use Each Record Type
- Use an A record for your root domain (example.com), when you know the IP address is stable, or when you need other record types at the same name (MX, TXT).
- Use a CNAME for subdomains (www.example.com, blog.example.com) pointing to CDNs, load balancers, or SaaS platforms where IPs may change.
- Use AAAA records alongside A records if you need IPv6 support. Check with our AAAA Lookup tool.
Frequently Asked Questions
Can I use a CNAME record at the root domain?
No. The DNS specification (RFC 1034) prohibits CNAME records at the zone apex because a CNAME cannot coexist with other record types like MX or TXT. Some DNS providers offer ALIAS or ANAME records as workarounds that resolve server-side.
Which is faster, an A record or a CNAME?
An A record is slightly faster because it resolves directly to an IP in a single lookup. A CNAME requires an extra DNS lookup to resolve the alias, then another to get the IP. The difference is usually a few milliseconds.
When should I use a CNAME instead of an A record?
Use a CNAME when pointing a subdomain to a service that may change its IP addresses, such as a CDN, load balancer, or SaaS platform. The CNAME follows IP changes automatically. Use an A record for root domains or when you need direct IP mapping.