HTTP & Networking
What is a CNAME record?
A DNS record that aliases one hostname to another, so the resolver follows the chain to whatever IP the target eventually points to.
A CNAME (Canonical Name) record says "this hostname is just another name for that hostname." When a resolver queries the alias, the DNS server returns the CNAME target, and the resolver follows it, possibly through more CNAMEs, until it finds an A or AAAA record with the actual IP.
CNAMEs are how SaaS products give you a custom domain. You point app.yourbrand.com to a CNAME like cname.vercel-dns.com or proxy.cloudflare.com, and the provider's infrastructure handles the rest, including issuing TLS certificates for your domain.
There's one important rule: a CNAME cannot coexist with other records on the same name, which is why you can't put a CNAME on the apex (root) of a domain in standard DNS. Most providers offer "CNAME flattening" or "ALIAS" records as a workaround.
In the wild
- →
www.example.comCNAME →example.com - →
app.yourcompany.comCNAME →cname.vercel-dns.com - →
shop.yourbrand.comCNAME →myshop.shopify.com
FAQ
CNAME vs A record?
An A record points a name directly at an IP. A CNAME points a name at another name. CNAMEs let you change targets without updating every alias; A records are slightly faster (one fewer lookup).
Why can't I CNAME the root domain?
RFC 1034 disallows it: a CNAME forbids any other record on the same name, but the root needs SOA and NS records. CNAME flattening (Cloudflare) and ALIAS records (Route 53, DNSimple) are the workarounds.
Does a CNAME slow down DNS?
Marginally, it adds one resolution step. For a public-facing site behind a CNAME chain, the cost is negligible after caching warms up.
Related terms
The Domain Name System, the distributed database that translates human-readable domain names into the IP addresses computers actually route to.
The human-readable name that identifies a site on the internet, the part that maps to an IP address through DNS.
A prefix added to a parent domain to identify a separate section, app, or service, like `blog.example.com` or `api.example.com`.