How CNAME Chains Work and Why Dangling CNAMEs Are Dangerous

What a CNAME alias really does, why it cannot sit at the root domain, how to trace a chain to its final IP address and how to spot and remove dangling CNAMEs.

Updated September 29, 2026 5 min read

Use the free CNAME LookupFollow a hostname's CNAME chain to its final IP and spot dangling aliases

When you connect a custom domain to a hosted service, whether a help centre, a shop, a status page or a CDN, the setup instructions usually say "create a CNAME record pointing help.example.com to yourcompany.helpdesk.example". It takes a minute, it works, and it is forgotten. Years later the service is cancelled, the CNAME is still there, and it points at a name that anyone might be able to claim.

This guide explains how CNAME records resolve, what a chain of aliases looks like, the rules that make CNAMEs awkward at the root of a domain, and how to find aliases that point nowhere.

What a CNAME does

A CNAME (canonical name) record says "this name is an alias; look up that other name instead". It does not hold an address itself.

help.example.com.        300  IN CNAME  example.helpdesk.example.
example.helpdesk.example. 60  IN CNAME  lb-eu.helpdesk.example.
lb-eu.helpdesk.example.   60  IN A      198.51.100.40

When a browser asks for help.example.com, the resolver follows each alias until it reaches a name with A or AAAA records. It returns the whole chain along with the final addresses. Each hop has its own TTL, so the target service can change its own records at any time without you editing yours. That is the whole point of a CNAME: you delegate the "where does this live" decision to the service.

The rules

  • A CNAME cannot coexist with other records at the same name. If help.example.com is a CNAME, it cannot also have MX or TXT records.
  • No CNAME at the zone apex. The root example.com must have SOA and NS records, so it cannot be a CNAME. DNS providers work around this with proprietary ALIAS, ANAME or CNAME flattening features that resolve the target themselves and answer with A/AAAA records.
  • MX and NS targets should not be CNAMEs. Mail and delegation expect real hostnames.

CNAME or A record?

Use a CNAME when... Use an A/AAAA record when...
A third-party service controls the IP addresses You control the server and its fixed IP
The service may move you between servers or regions It is the root domain (unless your provider offers flattening)
You want the service's load balancing and CDN routing You need other record types at the same name

Trace a CNAME chain with our tool

The CNAME Lookup queries A and AAAA for the name and shows every alias the resolver followed.

  1. Open the CNAME Lookup and type a hostname into Hostname, for example www.example.com.
  2. Choose the resolver if you want, then click Follow CNAME.
  3. The chain appears top to bottom: your name, then each CNAME hop with its TTL, and finally the A/AAAA addresses highlighted in green.
  4. Read the findings. The tool counts the hops, warns when a chain has four or more hops, names the CDN or host when the target matches a known pattern, notes when you entered a root domain, and flags a dangling CNAME when the chain ends at a name with no address.
  5. Copy chain copies the full path, for example www.example.com -> ... -> 198.51.100.40.

If the name has no CNAME at all, the tool says it is a canonical name itself. Use the DNS Lookup to see its A, AAAA and other records.

Command-line equivalents

dig www.example.com
dig +short CNAME www.example.com
nslookup www.example.com

A plain dig query for the name shows the CNAME records in the answer section followed by the final A records. +short CNAME shows only the first hop.

Dangling CNAMEs and subdomain takeover

A CNAME is dangling when its target no longer exists or is no longer assigned to you. Typical causes:

  • A cloud storage bucket, app or site was deleted, but its CNAME remained.
  • A SaaS subscription ended and the custom-domain mapping was released.
  • A test environment was torn down without cleaning DNS.

The risk is that on some platforms anyone can create a new resource with the same target name. If they do, your subdomain now serves their content, under your domain name and trusted by browsers. This is called subdomain takeover, and it is used for phishing and cookie theft.

How to find and fix them

  1. List all CNAME records in your zone from your DNS provider's panel or export.
  2. Run each through the CNAME Lookup. Any finding that the chain ends without an address, or an NXDOMAIN, needs attention.
  3. If the service is still needed, re-create the resource at the provider and reclaim the name.
  4. If not, delete the CNAME. There is no benefit in keeping an alias to nothing.
  5. Make DNS cleanup part of every decommissioning checklist.

Note that some platforms return an address even for unclaimed names and show an error page instead. A chain that resolves is not proof that the resource belongs to you; open the site, and check the certificate with the SSL Certificate Decoder if in doubt.

Other CNAME problems

Slow first connection with long chains

Each hop can require a separate lookup when the cache is cold. Point your alias as close to the final target as the service allows.

"CNAME and other data" error

Your DNS panel refuses a TXT or MX record because the name is already a CNAME. Put the verification record at a different name if the service allows, or use an A record instead of the CNAME.

Changes not visible

Your own CNAME and each target hop are cached separately. Check what different resolvers return with the DNS Propagation Checker set to CNAME.

Frequently asked questions

Can I put a CNAME on my root domain?

Not in standard DNS, because the root must hold SOA and NS records. Many DNS providers offer ALIAS, ANAME or CNAME flattening, which gives the same effect by answering with A/AAAA records.

Does a CNAME affect SEO?

Search engines see only the final content and URL, not the DNS path. A CNAME to a hosting service is normal and has no direct SEO effect.

Is a chain of several CNAMEs a problem?

Two or three hops are common with CDNs. Longer chains add lookup time when the cache is empty and more places for something to break.

What is subdomain takeover?

It is when an attacker claims the resource a dangling CNAME points to, so your subdomain serves their content. Deleting unused CNAMEs prevents it.

Can a CNAME point to an IP address?

No. A CNAME target must be a hostname. To point a name at an IP address, use an A or AAAA record.

Try it now: CNAME Lookup

Loading tool…