Glossary / DNS records

CNAME record

A CNAME record is a DNS record that makes one hostname an alias of another, so www.example.com can follow wherever example.net points. Resolvers fetch the target's address records instead. A name that has a CNAME cannot hold any other records, so a CNAME cannot sit at the bare domain.

Copy the syntax

CNAME for a subdomain

www.example.com. 3600 IN CNAME example.net.

Keep the trailing dot on the target in zone files.

Check it

dig www.example.com CNAME +short

Returns the alias target.

Have a name in mind?

.com $24.99 first year, renews at $24.99/yr. Other endings: not on sale yet.

In plain English

A CNAME makes one name follow another. Point shop.example.com at your store's hostname, and it goes wherever the store goes.

What to do

  • Use a CNAME when a provider gives you a hostname to point at.
  • Keep CNAMEs off the bare domain.
  • Remove other records on that name before adding the CNAME.
How a CNAME lookup resolvesCNAME resolution: www.example.com aliases to example.net, whose A record returns the address.1 · Askwww.example.comresolver asks for A2 · AliasCNAME example.net.answer: look here3 · AddressA 192.0.2.10target's record returned
The resolver follows the alias, then returns the target's address to the browser.
Defined in
RFC 1034, section 3.6.2Source: RFC 1034
Type code
5Source: IANA
No other data rule
A CNAME name holds no other recordsSource: RFC 2181
MX and NS targets
Must not be CNAMEsSource: RFC 2181
What is a CNAME record used for?

CNAME records point a subdomain at a name someone else manages: a hosted shop, a help desk, a CDN or a landing page tool. When the provider changes its servers, your record keeps working because it names their hostname, not their IP.

They also save repetition. Point www, blog and docs at one host with CNAMEs, and you update only that host’s A record later.

Can I use a CNAME on the root domain?

No. The bare domain must hold NS and SOA records, and a CNAME name cannot hold anything else. Some DNS hosts offer a flattening or ALIAS feature that behaves like a CNAME at the root by returning the target’s address instead.

CNAME vs A record: which should I use?

Use an A record when you have a fixed IP address. Use a CNAME when a provider gives you a hostname to point at. Never put both on the same name.

CNAME record examples

Example targets use documentation-only names (RFC 2606).
NameTypeTargetUsed for
wwwCNAMEexample.com.www follows the bare domain
shopCNAMEshops.example.net.Hosted store
helpCNAMEexample.helpdesk.example.org.Support portal
em1234CNAMEu1234.wl.example.net.Email sender verification

How do I add a CNAME record?

  1. Copy the target hostname your provider gives you. It looks like shops.example.net.

  2. In your DNS editor, add a record of type CNAME with the subdomain as the name, for example shop.

  3. Paste the target and save. Remove any A or TXT record on that same name first, or the editor will refuse it.

  4. Run dig shop.example.com +short. You see the target name followed by its address.

Questions about CNAME record

Can a CNAME point to another CNAME?

Yes, chains work, but each hop adds a lookup and a point of failure. Keep chains short, ideally one hop. Never create a loop, where two names alias each other.

Can I put a CNAME and an MX record on the same name?

No. A name with a CNAME cannot hold other records, so MX records must live on a name without a CNAME. That is one reason mail is usually set on the bare domain.

Does a CNAME affect SEO?

No. Search engines see the URL in the browser, not the DNS chain behind it. What matters for SEO is the final URL, redirects and content, not whether DNS used an alias.

How long does a new CNAME take to work?

A brand-new name usually resolves within minutes. If you replaced an older record, resolvers keep the old answer until its TTL passes.

Put it to work on your own domain

See the first-year and renewal price before you pay.

.com first year$24.99, renews $24.99Check a domain
↑