Skip to main content

DNS Basics

What a CNAME Record Is and When You Actually Need One

How a CNAME aliases one hostname to another instead of an IP address, why the root domain can't use one, and where CNAMEs show up in real setups.

Alias

What a CNAME creates — hostname to hostname, not to an IP

0

CNAMEs allowed on a root domain alongside other records

24/7

Human support for CNAME and DNS setup

Free

DNS management included with hosting

In short

A CNAME (Canonical Name) record aliases one hostname to another hostname, rather than pointing directly to an IP address the way an A record does. When a resolver looks up a CNAME, it follows the chain to whatever hostname is listed, then resolves that hostname's own A record to get the final IP — an extra hop that keeps the alias updated automatically if the target's IP ever changes.

A root domain (yourdomain.com with no subdomain prefix) generally cannot use a CNAME, because DNS rules require the root to also carry other record types like MX, and a CNAME can't coexist with those on the same host.

A CNAME solves a specific problem: pointing a hostname at something that might change its underlying IP address without needing to update DNS every time that happens. Instead of hard-coding an IP, the CNAME just says 'this hostname means the same thing as that other hostname,' and lets that other hostname's own record handle the actual address.

This guide explains how a CNAME differs from an A record, why the root domain is off-limits for one, and the situations where a CNAME is genuinely the right tool — subdomains, CDNs, third-party services, and domain verification among them.

How a CNAME Works Differently From an A Record

An A record maps a hostname straight to an IP address in one step. A CNAME maps a hostname to another hostname instead, which then needs its own record (usually an A record) to resolve the rest of the way to an actual IP. So looking up www.example.com might return a CNAME pointing to example.com, and only then does example.com's A record supply the final address.

This extra layer of indirection is the whole point: if the target's IP ever changes, every hostname that CNAMEs to it updates automatically without needing its own record touched. That's especially valuable when the target is a third-party service (like a CDN or an email platform) whose IP addresses the site owner doesn't control and shouldn't need to track.

Why the Root Domain Can't Use a CNAME

DNS specifications require that if a hostname has a CNAME record, it can't have any other record type at the same time — no MX for email, no TXT for verification, nothing else. A root domain almost always needs at least an MX record for email and often a TXT record for verification, which makes a CNAME at the root technically invalid in standard DNS.

This is why a root domain needs an A (or AAAA) record pointing directly at an IP, while the www version of the same site is commonly set up as a CNAME pointing back at the root — www doesn't need MX or other coexisting records, so the CNAME restriction doesn't apply to it the same way.

Where CNAMEs Actually Get Used

The most common everyday CNAME is www pointing at the root domain, so that both versions of a URL stay in sync automatically. Beyond that, CDNs frequently ask a site owner to CNAME a subdomain (like cdn.yourdomain.com) to a hostname the CDN provides, letting the CDN handle IP changes on their end without the site owner ever touching DNS again.

Third-party email or marketing platforms often require a CNAME too — for example, pointing a subdomain like mail.yourdomain.com or a tracking hostname at a provider's given target, which is how services stay attached to a custom domain rather than showing the provider's own generic domain to recipients or visitors.

Domain Verification via CNAME

Some services verify domain ownership by asking for a CNAME instead of a TXT record — the service provides a specific hostname and a target value, and once that CNAME is added and resolves correctly, the service confirms the domain is genuinely controlled by whoever added it. This works because only someone with actual DNS access could add that exact record.

The main thing to get right here is precision: the host and target values usually need to be entered exactly as the service provides them, including any trailing characters, since a partial or reformatted value simply won't match what the verification check is looking for.

What Is a CNAME Record & When to Use One

Getting CNAMEs Right Without the Guesswork

Hosting Cheap's DNS panel makes adding a CNAME for www, a CDN, or a third-party service straightforward, with the record types laid out clearly so a CNAME doesn't accidentally end up on a host it can't actually work on.

24/7 human support is available for the trickier cases — like a CDN or email platform's verification CNAME that isn't resolving as expected — rather than leaving it to trial and error.

  • Clear DNS panel for adding CNAME records correctly
  • 24/7 human support for third-party CNAME and verification setups
  • Free managed migration that preserves existing CNAME configurations
  • Free auto-renewing SSL that covers www alongside the root domain

Why Hosting Cheap

What you get

Clear DNS Record Panel

Add a CNAME without confusing it with an A record or misapplying it to the root.

24/7 Human Support

Get help matching a third-party service's exact CNAME host and target values.

Free Managed Migration

Existing CNAME setups for CDNs or email tools move over without being dropped.

Free Auto-Renewing SSL

Covers both the root domain and a www CNAME alias without extra configuration.

Daily Backups

A safety net while adjusting DNS records for a new CDN or service integration.

Pure NVMe SSD + LiteSpeed

Fast origin server performance behind whatever CNAME points to it.

How It Works

Get set up in a few steps

1

Identify the target hostname

Get the exact hostname the CNAME should point to, whether that's the root domain, a CDN, or a service provider.

2

Add the CNAME to a subdomain, not the root

Apply it to www or another subdomain, since the root domain generally can't carry a CNAME.

3

Verify it resolves as expected

Check the CNAME with a DNS lookup tool to confirm it follows through to the correct final destination.

Included

Everything you need, on every plan

  • CNAME applied to a subdomain like www, not the bare root domain
  • No other record types (MX, TXT) exist on the same host as the CNAME
  • Target hostname entered exactly as the third-party service specifies
  • CNAME resolves correctly when checked with a DNS lookup tool
  • Root domain has its own A record separate from any CNAME setup
  • Verification CNAMEs double-checked for trailing characters or typos

FAQ

Frequently asked questions

Can I use a CNAME for my root domain?

No, standard DNS rules don't allow a CNAME to coexist with other record types like MX on the same host, and a root domain almost always needs those other records. The root domain should use an A record instead.

What's the difference between a CNAME and an A record?

An A record points a hostname directly to an IP address, while a CNAME points a hostname to another hostname, which then resolves further to get the actual IP. CNAMEs are useful when the target's IP might change and shouldn't need manual updates.

Why does a CDN ask me to add a CNAME?

A CDN wants to control the IP addresses traffic resolves to on their end, so they can change infrastructure without the site owner needing to update DNS. Pointing a subdomain at the CDN's given hostname via CNAME accomplishes that automatically.

Does a CNAME slow down my website?

The extra lookup step is negligible in practice, typically adding a fraction of a millisecond, since DNS resolution itself happens well before any page content loads. It isn't a meaningful performance concern.

Can I point a CNAME to another CNAME?

Technically it's possible, but it's discouraged since chaining CNAMEs adds extra lookup steps and increases the chance of a broken link if any hostname in the chain changes or is removed. Pointing directly to the final target is the more reliable setup.

Why isn't my CNAME verification passing?

This is usually caused by a typo, a missing or extra trailing period, or the record simply not having propagated yet across DNS resolvers. Checking the exact value against what the service provided, character for character, resolves most cases.

Set Up CNAMEs the Right Way From the Start

A clear DNS panel and 24/7 human support make aliasing subdomains for CDNs and services painless.

Get Started