Skip to content

CNAME Lookup

A CNAME record makes one hostname an alias for another, delegating every lookup to the target name. This tool shows the exact CNAME a hostname publishes, or reports plainly that there is none — which is normal at a zone apex and for names published directly as A or AAAA records.

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 A
A textbook CNAME: www is an alias for the apex.

RFC 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 ↓

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.

SituationUseWhy
Pointing www at your apexCNAMEOne record to maintain; the apex address is the single source of truth.
Apex pointing at a SaaS hostALIAS/ANAME or the provider IPsCNAME is illegal at the apex.
Subdomain on a load balancer or CDNCNAMEThe provider changes addresses without warning; the alias follows automatically.
Host you control on a static IPA recordNo indirection needed, one fewer lookup.
Domain-verification tokenCNAME or TXT as the vendor specifiesA 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

  1. 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.
  2. CNAME at the apex. Most providers reject it; those that accept it break MX and SOA handling. Use ALIAS/ANAME instead.
  3. Trailing-dot mistakes. In a zone file, target.example.com without the trailing dot is expanded relative to the zone, producing target.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.
  4. 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.
  5. 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.
  6. 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.
Dangling CNAMEs pointing at deprovisioned cloud resources are actively exploited. If this tool shows a CNAME whose target returns NXDOMAIN, delete the record today — not next sprint.

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) A
If the final command prints nothing, the CNAME target does not resolve — that is a dangling alias.

One 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.

Frequently asked questions

Can I use a CNAME at my root domain?
No. The apex must hold SOA and NS records, and a CNAME may not coexist with any other record, so the combination is forbidden by RFC 1034. Use your provider's ALIAS, ANAME, or CNAME-flattening feature, which publishes ordinary A and AAAA records at the apex while letting you configure a hostname.
Why does my CNAME lookup return nothing when my DNS panel shows one?
Two likely reasons. Either the record is at the apex and your provider is flattening it into A records — in which case the A lookup will show addresses — or you are querying a different name than the one you configured. Check for a missing or extra subdomain label.
Does a CNAME slow down my site?
Marginally. Each alias adds a resolution step, though resolvers cache aggressively and usually return the whole chain in a single response. One CNAME is negligible. A chain of four or five, each with a short TTL, is measurable on first connection and worth collapsing.
Can a CNAME point to an IP address?
No. The value must be a domain name. Some control panels accept an IP and silently create an A record instead; others store it and produce answers no resolver can use. If you have an address, use an A record.
Why did email stop working after I added a CNAME?
Because a CNAME redirects every lookup at that name, including MX. If you put a CNAME on a name that also needs to receive mail, the mail routing now comes from the target zone instead of yours. Remove the CNAME and publish explicit records, then re-check with the MX lookup.
What is a dangling CNAME and why is it dangerous?
It is a CNAME whose target no longer exists — typically a cloud resource that was deleted while the DNS record stayed. Anyone who can claim that target name on the same platform can then serve content on your subdomain, receive cookies scoped to your domain, and pass domain-validated certificate checks. Delete the record as soon as the service is decommissioned.
Is a CNAME the same as a URL redirect?
No, and confusing the two causes real outages. A CNAME operates in DNS and is invisible to the browser: the original hostname stays in the address bar and in the TLS handshake, so the target must present a certificate valid for *your* name. A redirect happens over HTTP, changes the URL, and requires a web server to answer first.