Canonical Name Record (CNAME)
Creates an alias from one domain name to another — the target resolves to an IP separately.
Standards: RFC 1035
What is a DNS CNAME record?
A CNAME (Canonical Name) record creates an alias: it maps one hostname to another hostname rather than directly to an IP. DNS resolvers follow the CNAME chain until they reach an A or AAAA record. For example, www.example.com CNAME → example.com, then example.com A → 93.184.216.34. CNAMEs are useful for pointing subdomains to external services (CDNs, hosting providers, SaaS tools) using their provided domain name so IP changes propagate automatically. A CNAME cannot be used at the zone apex (e.g. bare example.com) because RFC 1034 forbids it when an SOA or NS record exists. Use ALIAS/ANAME records instead for apex aliasing. Important: a CNAME record cannot coexist with other record types for the same name (except DNSSEC records). This is why you cannot create a CNAME and an MX record for the same hostname.
Record Structure
| Field | Description |
|---|---|
| Name | The alias hostname, e.g. www.example.com |
| TTL | Time to live in seconds |
| Class | IN |
| Type | CNAME |
| RDATA | The canonical name (target), e.g. example.com or cdn.provider.com |
Examples
www.example.com. 3600 IN CNAME example.com.
cdn.example.com. 300 IN CNAME d1234.cloudfront.net.
docs.example.com. 3600 IN CNAME sites.example.notion.site.
Common Issues & Fixes
CNAME at apex breaks email / MX records
Using a CNAME for the bare domain (e.g. example.com) alongside MX records violates RFC 1034 and breaks email.
✓ Fix: Use an ALIAS or ANAME record for the apex instead, or use a flattened CNAME (supported by Cloudflare, Route 53).
CNAME chain too long / infinite loop
A CNAME pointing to another CNAME that loops back to the original causes NXDOMAIN errors.
✓ Fix: Remove the loop. CNAME chains should resolve to an A/AAAA record within 1–3 hops.