A CNAME record (Canonical Name) creates an alias from one hostname to another. Instead of mapping to an IP address, it maps to another hostname which is then resolved normally.
Format
www.example.com. 3600 IN CNAME example.com.
shop.example.com. 3600 IN CNAME stores.myshopify.com.
blog.example.com. 3600 IN CNAME example.ghost.io.
When a resolver encounters a CNAME, it follows the chain until it finds an A or AAAA record.
Rules
- Cannot be used at the domain apex (
example.com/@). Only allowed on subdomains. - Cannot coexist with other record types at the same name — no CNAME + MX at the same hostname.
- Can chain but more than 3 hops slows resolution.
CNAME Flattening (ALIAS)
Some DNS providers offer CNAME-like behavior at the apex: Cloudflare (CNAME Flattening), AWS Route 53 (ALIAS), and DNSimple (ALIAS). These resolve the target and return an A record, making it appear as an A record to clients.
Common Use Cases
- Pointing
www.to the root domain - Pointing a subdomain to a CDN, SaaS, or load balancer whose IP changes
- Keeping multiple subdomains synchronized — update the target’s A record and all CNAMEs update automatically