What a CNAME actually does
CNAME stands for canonical name. When a resolver finds a CNAME at the name it was asked about, it abandons that name entirely and restarts the query at the target. Every record type follows: A, AAAA, MX, TXT — all of them are read from the target name, not the alias. This is the property that makes CNAMEs useful and also the property that makes them dangerous.
dig +noall +answer www.github.com CNAME
www.github.com. 3217 IN CNAME github.com.
# Asking for A gets you the CNAME *and* the target's addresses in one answer
dig +noall +answer www.github.com ARFC 1034 states the constraint that governs everything else: a CNAME must be the only record at its name. If www.example.com is a CNAME, it may not also have an A record, an MX record, or a TXT record. Publishing both is a configuration error that some nameservers refuse outright and others serve inconsistently, producing intermittent failures that survive every cache flush you try.
Why the apex cannot be a CNAME
The zone apex — example.com with no subdomain — must carry SOA and NS records, because that is what makes it a zone. Since a CNAME may not coexist with other records, the apex can never be a CNAME. This is not a limitation of your DNS provider; it is structural.
Read the full explanation of cname lookup results ↓Show less ↑
Providers work around it with ALIAS, ANAME, or CNAME flattening. All three do the same thing: the provider resolves the target itself and serves the resulting addresses as ordinary A/AAAA records at the apex. On the wire there is no CNAME, which is why this tool will report "no CNAME" for such a name while your control panel shows one. That is correct behaviour, not a bug — verify what is actually published with the A record lookup.
| Situation | Use | Why |
|---|---|---|
| Pointing www at your apex | CNAME | One record to maintain; the apex address is the single source of truth. |
| Apex pointing at a SaaS host | ALIAS/ANAME or the provider IPs | CNAME is illegal at the apex. |
| Subdomain on a load balancer or CDN | CNAME | The provider changes addresses without warning; the alias follows automatically. |
| Host you control on a static IP | A record | No indirection needed, one fewer lookup. |
| Domain-verification token | CNAME or TXT as the vendor specifies | A CNAME here blocks every other record at that name — check the vendor is not also asking for a TXT at the same name. |
Common failures and fixes
- CNAME plus other records at the same name. Symptoms range from missing mail to intermittent resolution failures. Remove everything else at that name, or convert the CNAME to an A record and keep the siblings.
- CNAME at the apex. Most providers reject it; those that accept it break MX and SOA handling. Use ALIAS/ANAME instead.
- Trailing-dot mistakes. In a zone file,
target.example.comwithout the trailing dot is expanded relative to the zone, producingtarget.example.com.example.com.In most web control panels the opposite convention applies. If this tool shows a doubled domain in the target, that is what happened. - A chain of CNAMEs. Legal but costly: each hop is another lookup and another chance to break. Resolvers cap chain length (typically around 8 hops) and return SERVFAIL beyond it. Collapse chains where you can.
- Dangling CNAME. The alias resolves but the target no longer exists, so the name returns NXDOMAIN. On cloud platforms this is a genuine security issue — subdomain takeover — because an attacker can register the abandoned target and serve content on your subdomain. Delete CNAMEs when you decommission the service they point at.
- Email breaks after adding a CNAME at the apex or at a mail name. Because the CNAME redirects the MX lookup too. Check with the MX lookup and the SPF checker.
Following the chain from the command line
# The CNAME itself
dig +short www.github.com CNAME
github.com.
# The whole chain plus the final addresses
dig +noall +answer www.github.com A
# Check for the illegal "CNAME and other data" case
dig +noall +answer www.example.com ANY
# Confirm the target actually exists (dangling-CNAME check)
dig +short $(dig +short www.example.com CNAME) AOne caution on the ANY query: many authoritative servers and resolvers now refuse or minimise ANY responses (RFC 8482), so an empty result there proves nothing. Query each type explicitly, or use the full DNS lookup which does exactly that.