A records point a domain directly to an IP address. CNAME records point a domain to another domain name. The choice depends on whether you control the IP and whether you are at the zone apex.
| Feature | A Record | CNAME Record |
|---|---|---|
| Maps to | An IPv4 address (e.g. 93.184.216.34) | Another domain name (e.g. cdn.example.net) |
| Zone apex allowed? | Yes | No (violates RFC 1034) |
| Coexists with other records? | Yes (can have MX, TXT, etc. at the same name) | No (CNAME must be the only record at that name) |
| Lookup latency | Single lookup | Requires chasing the alias (extra lookup) |
| Use case | Bare domain, servers with stable IPs | Subdomains pointing to external services |
| Example | example.com. A 93.184.216.34 | www.example.com. CNAME cdn.example.net. |
An A record maps a domain name directly to an IPv4 address. When a resolver queries for example.com and gets an A record, it knows exactly which IP to connect to. There is no indirection. This makes A records simple and fast.
Use A records when you have a stable IP address that you control, such as a dedicated server or a load balancer with a static IP. A records are also the only option for the bare domain (zone apex) in standard DNS. For IPv6 addresses, the equivalent is an AAAA record, which works identically but holds a 128-bit address instead of 32-bit.
The downside of A records is that if the IP address changes, you must update every A record that references it. If your infrastructure provider rotates IPs or you migrate to a new host, you need to update DNS and wait for TTL expiration before all clients see the change.
A CNAME (Canonical Name) record creates an alias from one domain name to another. When a resolver encounters a CNAME, it follows the alias and resolves the target domain instead. For example, www.example.com CNAME cdn.example.net means "to find the IP for www.example.com, go look up cdn.example.net instead."
This indirection is valuable when the underlying IP address is managed by someone else. If you point your subdomain to a CDN, hosting platform, or SaaS provider via CNAME, they can change their IP addresses freely without requiring any update on your side. Your CNAME stays the same, and the resolution chain handles the rest.
The trade-off is an extra DNS lookup (the resolver must first resolve the CNAME, then resolve the target). In practice, this adds minimal latency because resolvers cache aggressively. The more significant constraint is the zone apex rule.
Per RFC 1034, a CNAME record cannot coexist with any other record at the same name. At the zone apex (the bare domain like example.com), there must always be SOA and NS records. Placing a CNAME there would violate this rule, because the CNAME would replace all other records at that name, breaking the zone's SOA and NS entries.
This means you cannot do example.com CNAME some-service.provider.com. You must use an A record (or AAAA) at the apex.
Some DNS providers offer proprietary workarounds. Cloudflare has "CNAME flattening," AWS Route 53 has "ALIAS records," and other providers use "ANAME." These all resolve the CNAME target at query time and return the resulting A/AAAA record directly, giving you CNAME-like behavior at the apex without violating the RFC. These are not standard DNS record types, so they only work with providers that support them.
custom.saasprovider.com.my-app.us-east-1.elb.amazonaws.com). Their IPs may change during scaling events.Look up the DNS records for any domain.
Look up DNS records