DNS record types · Updated

DNS CNAME record

A CNAME (canonical name) record makes one hostname an alias of another. A resolver that finds a CNAME looks up the target name instead and returns its addresses.

Look up a CNAME record

Check what DNS returns right now:

Format and example

www.example.com.   3600   IN   CNAME   cdn.example.net.
  • Name: The alias. This name may hold no other record type.
  • TTL: Seconds a resolver may cache the alias.
  • Value: The canonical hostname, never an IP address. It needs its own A or AAAA record.

Common mistakes

  • Placing a CNAME on the bare domain (example.com). The root always holds SOA and NS records, and a CNAME cannot share a name with anything. Use an A record, or your DNS host's ALIAS or ANAME record.
  • Adding a CNAME where an MX or TXT record already exists for the same name. The two conflict, and email verification records are the usual casualty.
  • Building long chains. Every extra hop is another lookup and another way to fail. Loops make the name unresolvable.
  • Pointing an MX or NS record at a CNAME. Both must point straight at a name with address records.

Related record types

A record, TXT record. The DNS record types guide compares them all.

Frequently asked questions

What is a CNAME record?

A CNAME record makes a hostname an alias for another hostname. It is commonly used to point www or a subdomain at a hosting, shop or CDN provider, so the provider can change IP addresses without you editing anything.

Can I use a CNAME on my root domain?

No. The root of a domain must hold SOA and NS records, and a CNAME cannot coexist with other records. Use an A record or an ALIAS/ANAME record if your DNS provider offers one.

What is the difference between a CNAME and an A record?

An A record answers with an IP address directly. A CNAME answers with another name, and the resolver continues from there. A CNAME follows the target automatically if its address changes.

Can a CNAME point to another CNAME?

Yes, but keep chains to one or two hops. Longer chains slow every lookup.

Why does my CNAME conflict with another record?

DNS forbids any other record type at the same name as a CNAME. Remove the other record, or move the CNAME to a subdomain.