A CNAME record (Canonical Name record) creates an alias from one domain name to another. Instead of pointing directly to an IP address, it points to another domain name, which then has its own A record. This means if the target IP changes, you only need to update one record.

CNAME Record Format

FieldExample
Namewww.example.com
TypeCNAME
TTL3600
Value (target)example.com

When a resolver looks up www.example.com, it sees the CNAME pointing to example.com, then looks up example.com's A record to get the IP address.

Common Uses of CNAME Records

  • www subdomain: www.example.com → example.com
  • CDN configuration: example.com → example.netlify.app or similar CDN domain
  • Third-party services: mail.example.com → mailservice.provider.com
  • Domain verification: Random subdomain → provider verification domain

CNAME Restrictions

  • Cannot be used at the root (apex) domain - only on subdomains
  • Cannot coexist with other record types on the same name
  • Adds an extra DNS lookup step (latency) compared to an A record

Should I Use A Record or CNAME for a Subdomain?

Use a CNAME when the target IP may change (hosted services, CDNs). Use an A record when you control the server and want the fastest resolution without an extra lookup.

People Also Ask

What is a CNAME record example?
www.example.com CNAME example.com - This makes www.example.com resolve to the same IP as example.com, following any changes to example.com's A record automatically.
What is the point of a CNAME record?
It decouples a hostname from an IP address. If the IP changes, you only update the A record, not every CNAME pointing to it.

Related: A records | DNS record types | DNS Lookup