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.com CNAME → example.com
  • app.yourcompany.com CNAME → cname.vercel-dns.com
  • shop.yourbrand.com CNAME → 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

Ship an agent that actually knows things.

Free tier, 10-minute integration, and the same API powering agents at Mintlify, daily.dev, and Propane. No credit card to start.