DNS record types

Understanding CNAME records

A CNAME (canonical name) record makes one name an alias of another. The resolver follows the alias and returns the target's address.

Updated · Published by HostFaddy · 3 min read

Look up the CNAME for a hostname

Free, no sign-up — results in seconds.

How a CNAME works

www.example.co.za.   3600  IN  CNAME  example.co.za.
shop.example.co.za.  3600  IN  CNAME  shops.myplatform.com.

When someone looks up shop.example.co.za, the resolver sees the CNAME, then looks up shops.myplatform.com and returns its address. If the platform changes its IP addresses, your record keeps working without any edits.

The rules that trip people up

  • A CNAME can't share a name with any other record. If shop has a CNAME, it can't also have an A, MX or TXT record.
  • No CNAME at the root (apex) of a domain. The root always has SOA and NS records, so a CNAME there breaks the rule above. Use A/AAAA records, or your DNS provider's ALIAS/ANAME/flattening feature.
  • Don't point MX or NS records at a CNAME. MX and NS targets must be names with their own A/AAAA records.
  • Keep chains short. A CNAME pointing to another CNAME works but adds lookups and failure points.
  • Mind the trailing dot. In many DNS panels, a target without a trailing dot gets your domain appended, turning shops.myplatform.com into shops.myplatform.com.example.co.za.

Where CNAMEs are commonly used

  • www pointing to the root domain.
  • Hosted services: online shops, help desks, landing-page builders and CDNs.
  • Microsoft 365 autodiscover and other email client set-up records.
  • DKIM keys published by email platforms (selector._domainkey → provider's key).
  • Domain verification for some services.

CNAME, A record or ALIAS — which should you use?

SituationUse
Root domain pointing at your own serverA (and AAAA if the server has IPv6)
Root domain pointing at a hosted platform that gives you a hostnameALIAS / ANAME / CNAME flattening, if your DNS provider supports it — otherwise the platform's published A records
www or a subdomain pointing at a hosted platformCNAME to the hostname the platform gives you
Subdomain pointing at your own serverA record, or a CNAME to your main domain if they share a server
Mail server name used in MX recordsA/AAAA — never a CNAME

What CNAME flattening does

Some DNS providers let you enter a CNAME-style target on the root domain. Behind the scenes they look up the target and answer with its A/AAAA addresses, so the zone stays standards-compliant. The result behaves like a CNAME for you, but resolvers only ever see ordinary A records. The trade-off is that the answer follows the provider's own refresh schedule rather than the target's TTL.

Looking up a CNAME

Use the CNAME lookup on the exact hostname (for example www.example.co.za), or:

dig www.example.co.za CNAME +short

If a hostname returns an address but no CNAME, it's using A/AAAA records directly.

Frequently asked questions

Can I put a CNAME on my root domain?

Not in standard DNS. Use A/AAAA records or your DNS provider's ALIAS/flattening feature instead.

Why does my CNAME lookup return nothing for my domain?

Root domains normally use A records, not CNAMEs. Try looking up www or the specific subdomain.

Does a CNAME slow down my website?

It adds one extra lookup the first time, which resolvers then cache. The effect is usually negligible.