A CNAME record (Canonical Name record) makes one domain name an alias of another. Instead of pointing at an IP address like an A record, a CNAME says "the answer for this name is whatever that other name resolves to." Example: www.example.com → CNAME → example.com.
CNAME vs A record: which one should I use?
| A record | CNAME record | |
|---|---|---|
| Points to | An IPv4 address | Another hostname |
| Use when | You control a stable IP | The target's IP may change (SaaS, CDN, PaaS) |
| Allowed at root domain | Yes | No (use ALIAS) |
| Extra lookup cost | None | One extra resolution step |
Rule of thumb: your own servers → A record; someone else's platform → CNAME. When you point shop.example.com at a hosted storefront via CNAME, the platform can change its IPs freely and your DNS keeps working.
Why can't I put a CNAME on my root domain?
The DNS standard says a name with a CNAME may have no other records - but every zone apex must carry SOA and NS records. So example.com itself cannot be a CNAME. The practical fix is an ALIAS (ANAME) record: it behaves like a CNAME but is resolved server-side and returned as A/AAAA answers, which is standards-compliant at the apex. ice.domains free DNS hosting supports ALIAS records on every zone at no cost.
Does a CNAME redirect visitors?
No - this is the most common misconception. A CNAME operates purely at the DNS layer: resolvers follow it silently and the browser's address bar never changes. If you want old-site.com to visibly send users to new-site.com, you need an HTTP 301 redirect from a web server, not a CNAME.
CNAME best practices
- Avoid chains. CNAME → CNAME → A works but adds latency and failure points. Point directly at the final name.
- Don't mix records. A name with a CNAME cannot also have MX, TXT, or other records - put those on the target name or use a different host.
- Mind email. Never CNAME a name that receives mail; MX records must live on a CNAME-free name.
- TTL applies per hop. Propagation of a CNAME change is governed by the CNAME's own TTL, not the target's.