Contents
7 sections · 6 min read
Diagram showing CNAME record aliasing subdomain to canonical domain name
Domain Management

What Is a CNAME Record? How DNS Aliases Work and When to Use Them

A
Domain 360 Team
·July 13, 2026·6 min read

A CNAME record is a DNS alias. It maps one domain name to another domain name — telling DNS resolvers: for this name, look up that name instead. The resolver follows the alias, resolves the target to an IP address, and returns the final result.

Quick answer: A CNAME creates an alias from one domain name to another — so you can point multiple names to the same destination without duplicating records. Here is how they work and when to use them instead of A records.

How Does CNAME Resolution Work?

When a browser looks up www.example.com and finds a CNAME pointing to example.com, the resolver does not stop there. It fetches the canonical target (example.com), resolves that to an IP address, and returns the final IP. The browser connects to the IP.

This indirection is the point. When example.com's A record changes (server migration), www.example.com automatically follows — no additional DNS edits required.

What Are Some Real CNAME Examples?

www.yourdomain.com → yourdomain.com (www visitors reach the same server as non-www visitors)

blog.yourdomain.com → yoursite.wordpress.com (branded subdomain pointing to a hosted blog platform)

api.yourdomain.com → your-app.herokuapp.com (stable branded URL that survives moving hosting providers)

abc123.yourdomain.com → verify.someservice.com (domain ownership verification for a third-party service)

CNAME vs A Record: What's the Difference?

A record: Maps a name directly to an IP address. Required for root domains. CNAME: Aliases one name to another name. Used when the target's IP may change.

SituationUse
Root domain (yourdomain.com)A record
Subdomain to external serviceCNAME
Name where IP may changeCNAME
Name needing MX or TXT recordsA record

What Is the Root Domain Limitation?

You cannot set a CNAME on the apex domain (yourdomain.com without any subdomain). DNS prohibits this because root domains need other record types — particularly MX records for email — and CNAME's exclusivity rule means no other records can coexist at the same hostname.

Workarounds: Cloudflare CNAME Flattening resolves the CNAME chain at the root and returns the final IP, bypassing the prohibition. Some DNS providers offer ALIAS or ANAME records that work like CNAMEs at the root.

What Is CNAME Exclusivity?

If you set a CNAME for a hostname, you cannot set any other record type for that exact hostname — no A, MX, TXT, or anything else. This is why CNAMEs cannot be used at the root domain where email (MX records) is needed.

How Do You Check Your CNAME Records?

dig yourdomain.com cname or: nslookup -type=cname www.yourdomain.com

If the result shows the canonical name followed by an A record with an IP, the chain resolves correctly. The DNS lookup commands guide covers reading these results in full.

What Are CNAME Chains?

A CNAME can point to another CNAME. Chains of 2-3 are usually fine. Chains of 4+ add latency and some resolvers refuse to follow beyond a certain depth. Avoid chains where possible — point CNAMEs directly to A records.

CNAME records depend on the root domain remaining registered. An expired domain stops all DNS resolution — every CNAME alias pointing through it fails. Tracking domain expiry with a domain management dashboard keeps the DNS chain working.

Quick Answers

What is a CNAME record?
A CNAME (Canonical Name) record creates an alias from one domain name to another. When DNS resolves a CNAME, it follows the alias to the target domain and resolves that instead. Example: www.example.com CNAME points to example.com. Visitors reaching www are transparently redirected through the CNAME to wherever example.com resolves.
When should I use CNAME instead of an A record?
Use CNAME for subdomains that should always follow another name, such as www pointing to the apex domain, blog pointing to a hosted platform, or api pointing to a cloud service hostname that may change its IP address. Use A records when you need to point directly to a specific IP address.
Can I use CNAME for the root domain (example.com)?
No. The DNS standard prohibits CNAME records at the zone apex (the root domain without subdomain). Some DNS providers offer proprietary ALIAS or ANAME records that achieve the same result using different technical mechanisms. Cloudflare's CNAME flattening handles this automatically.
Can a CNAME point to another CNAME?
Technically yes, but it creates a CNAME chain that every resolver must follow sequentially. Chains of 2-3 are usually fine; longer chains add latency and some resolvers refuse to follow beyond a certain depth. Avoid chains where possible and point CNAMEs directly to A records.
Can a domain have both a CNAME and other records?
No — a CNAME is exclusive for its name. If you set a CNAME for a hostname, you cannot set any other record type for the exact same hostname (not A, MX, TXT, etc.). This is why you cannot CNAME the root domain — root domains need MX records for email, which conflicts with the CNAME exclusivity rule.

Never lose a domain again

Track every domain you own in one dashboard. Free for up to 15 domains.