21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

CNAME Record Explained

Quick answer

A CNAME record, DNS type 5, makes one hostname an alias of another; it never stores an IP address. The resolver follows the alias and reads the target's A or AAAA record, so one IP change updates every alias. A CNAME must be the only record at its name, so it cannot sit on the bare domain.

For site owners and developers setting up www, CDN, shop or verification records who need to know when a CNAME works and when it breaks.

✓ In business since 2005
✓ INR + GST billing
✓ 24/7 Email Support — avg reply < 60 min
GuideWebJi®
knowledge
Read time
4 min
Sections
7
Updated
14 Nov 2026
Written by
WebJi® team

What is a CNAME record?

A CNAME (canonical name) record, DNS type 5, makes one hostname an alias of another hostname; it never stores an IP address. A resolver that finds a CNAME restarts the lookup at the target name and uses that name's A or AAAA record.

; zone file view
www.example.com.    3600  IN  CNAME  example.com.
example.com.        3600  IN  A      203.0.113.10

Here www.example.com ends up at 203.0.113.10, but the browser still asks the web server for www.example.com. If the server's IP changes, you edit one A record and every alias follows.

  • Value: always a hostname, never an IPv4 or IPv6 address.
  • Target: can be in the same domain or a different one (a CDN, shop platform or SaaS service).
  • Exclusive: the name holding a CNAME cannot hold any other record type (RFC 1034, clarified in RFC 2181).

How is a CNAME different from an A record?

An A record maps a name directly to an IPv4 address, while a CNAME maps a name to another name; use A records for the bare domain and mail hosts, and CNAMEs for labels that should follow another hostname. The rest of the comparison follows from the "only record at this name" rule.

CNAME vs A record
FactorCNAMEA record
DNS type51
Points toAnother hostnameAn IPv4 address
Can share the name with MX, TXT, NSNoYes
Valid on the bare domain (apex)NoYes
When the server IP changesFollows the target automaticallyEdit each record
Extra lookupYes, one per hopNo

For a decision guide that includes mail, see A record vs CNAME; the full list of types is in DNS records explained.

Why can't you put a CNAME on the root domain?

The bare domain (apex), such as example.com, must already hold SOA and NS records, and a CNAME cannot share its name with any other record, so a standard CNAME at the apex is invalid. Use an A record (and AAAA for IPv6) on the apex and a CNAME on www or another label.

Some DNS providers offer a workaround called CNAME flattening, ALIAS or ANAME: you enter a hostname at the apex, and the provider looks it up and answers with plain A/AAAA records. Because the answer on the wire is an address, SOA, NS and MX can stay. A standard cPanel zone has no such option, so if a vendor insists on an apex CNAME, host the DNS zone with a provider that supports flattening. Never delete the apex NS or SOA records to force one in.

What are CNAME records used for?

Most CNAMEs do one of three jobs: point www at the bare domain, point a subdomain at a CDN or platform hostname, or publish a verification or DKIM record a vendor supplies. Each keeps the vendor free to change its servers without asking you to edit IP addresses.

Typical CNAME records on a business domain
NameTarget examplePurpose
wwwexample.comwww and the bare domain share one address
shopHostname given by the store platformHosted shop on your own subdomain
cdnHostname given by the CDNServe images and files from the CDN
selector._domainkeyHostname given by the mail providerDKIM key published by the provider

A CNAME is not a redirect: the address bar keeps the name the visitor typed, and the target server must be configured to accept your hostname (and serve a certificate for it). To send visitors to a different URL, use an HTTP 301 instead; see redirecting a domain to another domain.

How do you add a CNAME record in cPanel?

In cPanel open Zone Editor, click Manage beside the domain, add a CNAME with only the label (such as www or shop) as the name and a hostname as the target, and save. Edit the zone only where the domain's live nameservers point; a record saved anywhere else has no effect.

  1. Check which nameservers the domain uses: dig +short NS example.com. Edit DNS at that provider.
  2. In cPanel, open Zone Editor → Manage for the domain and choose Add Record → CNAME.
  3. In Name, type the label only (shop); the panel appends the domain.
  4. In Record, type the target hostname, not an IP. Save.
  5. Verify: dig +short shop.example.com CNAME should print the target hostname.

If the saved name reads shop.example.com.example.com, the full domain was typed into Name; change it to the label. Other control panels, including ControlPanel.Systems, have an equivalent DNS editor with the same fields.

Why is a CNAME record not working?

A CNAME usually fails for one of four reasons: another record already exists at that name, the target has no A or AAAA record, the zone you edited is not the one the live nameservers publish, or old answers are still cached. Check them in that order.

  • Conflict: delete any A, TXT or MX on the same name; most panels refuse to save the CNAME until you do.
  • Dead target: run dig +short target-hostname; no address means the chain ends nowhere.
  • Wrong zone: compare dig +short NS example.com with the provider you edited.
  • Caching: resolvers keep the previous answer until its TTL expires; see DNS propagation.
  • Long chains: CNAME-to-CNAME chains work but add lookups; point at the final hostname where possible.

To compare answers from several resolvers at once, check DNS records walks through the tools.

FAQ

Frequently asked questions

Can a CNAME record point to an IP address?

No. The value must be a hostname. An IPv4 address belongs in an A record and an IPv6 address in an AAAA record. A panel that accepts an IP in a CNAME field is creating an invalid record.

Can a name have both a CNAME and an MX record?

No. A CNAME must be the only record at its name. If a hostname needs mail, give it an A record and an MX record instead of a CNAME; see what an MX record is.

Does a CNAME slow down my website?

Slightly, on the first visit only: the resolver makes one extra lookup per hop, usually a few milliseconds, and then caches the result for the TTL. A single CNAME has no noticeable effect on page speed.

Does a CNAME affect SEO?

No. Search engines see the hostname the visitor uses, not the DNS route behind it. What matters for SEO is choosing one preferred version (www or non-www) and 301-redirecting the other to it.

DNS rules checked against RFC 1034 and RFC 2181 · Reviewed by the WebJi® team, Jaipur, 15 November 2026.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.