The Short Answer
- A record: maps a name to an IPv4 address, for example
example.com → 203.0.113.10. The AAAA record does the same for IPv6. - CNAME record: says a name is an alias of another name, for example
www.example.com → example.com. The resolver then looks up the target’s address.
You can see a domain’s A, AAAA and CNAME records with our DNS Record Lookup.
When to Use an A Record
- For the root domain (
example.com). - When you control the server and its IP address is stable.
- For nameserver and mail server hostnames, which must resolve to addresses directly.
When to Use a CNAME
- When a service gives you a hostname instead of an IP address, such as a CDN, a website builder or a SaaS help desk. If the provider changes its addresses, your site keeps working because the CNAME follows the target.
- For several subdomains that should always point to the same place.
Rules and Restrictions for CNAMEs
No Other Records Next to a CNAME
A name with a CNAME cannot have any other record type. That is why a CNAME is not allowed at the root of a domain, which must hold SOA and NS records — and usually MX and TXT records for email.
ALIAS, ANAME and CNAME Flattening
Many DNS providers offer a workaround for the root domain: an ALIAS or ANAME record, or CNAME flattening. The provider resolves the target itself and returns ordinary A records. The result behaves like a CNAME at the root without breaking the rules.
MX and NS Must Not Point to a CNAME
Mail exchanger and nameserver records should point to names that have A or AAAA records directly. See how to look up MX records.
Avoid Long Chains
Each CNAME adds a lookup. Chains of several CNAMEs slow down resolution and are fragile.
Common Mistakes
| Mistake | Result |
|---|---|
| CNAME at the root domain next to MX records | Email or the website breaks, depending on the provider |
| CNAME to a deleted cloud resource | “Dangling” record that someone else may take over |
| A record with an old server address after a move | Visitors reach the old server |
| CNAME target without the trailing dot in raw zone files | The zone name is appended to the target |
After any change, check resolvers worldwide with the DNS Propagation Checker.