An A record answers a lookup directly with an IPv4 address (its IPv6 twin is the AAAA record). A CNAME says "this name is really that other name; look that up instead", so the resolver follows it to the target's own A/AAAA records. Use A/AAAA records for names you control the addresses of, including the bare domain; use a CNAME for subdomains that should follow a hostname someone else manages, such as a CDN, a SaaS platform or a load balancer whose IP addresses change.
At a glance
| Property | A record | CNAME record |
|---|---|---|
| Points to | An IPv4 address (AAAA: an IPv6 address) | Another domain name (the canonical name) |
| Example | www.example.com. 300 IN A 192.0.2.10 |
www.example.com. 300 IN CNAME example.net. |
| Lookups needed | One answer | The alias plus the target's records (resolvers usually return the chain in one response) |
Allowed at the zone apex (example.com) |
Yes | No |
| Can coexist with other records at the same name | Yes (several A records, MX, TXT and so on) | No: a CNAME must be the only record at its name (DNSSEC records aside) |
| Can be the target of MX or NS records | Yes (MX and NS must point at names with A/AAAA records) | No |
| When the target's IP changes | You must update the record | Nothing to do; it follows automatically |
| Multiple values for load spreading | Yes, several A records | No, exactly one target |
| Typical uses | Bare domain, your own servers, mail hosts | www, CDN hostnames, SaaS custom domains, verification subdomains |
Look up what a name currently returns with the DNS Record Lookup; the answer for a CNAME shows the alias and then the target's addresses.
A record
An A record is the final answer: a name and an IPv4 address with a TTL. Several A records on one name give simple round-robin load spreading, and an AAAA record next to it makes the name reachable over IPv6. Because A records can coexist with anything, they are what you use at the root of a domain, alongside its NS, SOA, MX and TXT records.
Choose an A (and AAAA) record when:
- The name is the bare domain (
example.com). - You run the server and know its static address.
- The name must also carry other records, such as MX or TXT.
- The name is the target of an MX or NS record.
CNAME record
A CNAME delegates the answer to another name. When a provider moves its servers or adds addresses, your alias follows without you touching your zone. The cost is a few rules: the CNAME must be alone at its name, it cannot sit at the apex, it adds a step to resolution (each name in the chain has its own TTL), and chains of CNAMEs pointing at CNAMEs slow lookups and are fragile. Never leave a CNAME pointing at a service you have cancelled: someone else may claim that hostname and serve content on your subdomain ("subdomain takeover").
Choose a CNAME when:
- The target is a hostname a provider tells you to use (CDN, hosting platform, e-mail or marketing service).
- You want several names (
www,shop,docs) to follow one canonical host. - The provider's IP addresses may change without notice.
Which should you choose?
- Bare domain: A and AAAA records, or the provider's ALIAS/ANAME/flattening feature if the target is a hostname.
wwwor another subdomain on a CDN or SaaS platform: CNAME to the hostname they give you.- Your own server with a fixed address: A and AAAA records.
- A name that also needs MX or TXT records: A/AAAA, because a CNAME cannot share its name.
- Mail server named in an MX record: A/AAAA, never a CNAME.
After a change, lower the TTL in advance and watch the new answer spread with the DNS Propagation Checker. If the alias serves a website, confirm with the SSL Certificate Checker that the target's certificate covers your name. For the whole resolution process, see How DNS Works.