FAQ Domains & DNS

How to add a CNAME record

A CNAME points one name at another instead of at an address, and it comes with one hard rule about what else can share its name.

Updated 4 min read Beginner

A CNAME record points one name at another name, not at an address. Where an A record says "this name means this IP address", a CNAME says "this name means whatever the target name currently means" — so if the target's address ever changes, the CNAME follows automatically without needing an edit of its own.

Adding one

In the DNS section of your control panel, add a new record and select CNAME as the type. You need two pieces of information:

  • The name — the alias you are creating, for example shop for shop.yourdomain.com, or www for www.yourdomain.com.
  • The target — the existing name it should point at, written as a full hostname, such as yourdomain.com or a hostname supplied by a third-party service you are connecting.
www.yourdomain.com.   CNAME   yourdomain.com.

Leave the TTL at its default unless you are about to make a change you want to spread quickly, in which case see what a DNS TTL is for how lowering it in advance helps.

A name with a CNAME can have nothing else

DNS does not allow a name to hold a CNAME record alongside an A, MX, or TXT record. This is why a CNAME almost never sits on the bare domain (@) itself, since that name usually already carries an A record and often an MX record for email. Put CNAMEs on subdomains instead — www, or a name a third-party service asks you to create.

Where you will actually use one

The most common CNAME on any domain is www pointing back at the bare domain, so that both versions always resolve to the same place without being kept in sync manually. Third-party services also frequently ask you to create a CNAME as proof you control the domain, or to route a subdomain through their platform — a support desk tool, an email marketing sender, or a content delivery network, for example. In every case, copy the exact target hostname the service gives you rather than guessing at a similar-looking one.

Confirming it worked

Query it directly rather than trusting a browser reload, which may be showing you a cached answer:

dig +short CNAME shop.yourdomain.com
nslookup -type=cname shop.yourdomain.com    # Windows

The result should be the target hostname you entered. If nothing comes back yet, give it time — CNAME changes generally spread on the same schedule as other record types, covered in how long DNS propagation takes.

A CNAME cannot point at an IP address

If what you have is an IP address rather than a hostname, you need an A record, not a CNAME — a CNAME's target field only accepts a name. This trips people up because both records end up making a subdomain "work", but they solve different problems: an A record hard-codes an address, while a CNAME follows wherever its target currently points.

Related reading