What is a CNAME record, and how is it different from an A record?
CNAME and A records look interchangeable until the day you try to put a CNAME on your root domain, and your provider refuses, and nobody can tell you why.
A CNAME (Canonical Name) record points one host name at another host name; an A record points a host name at an IPv4 address. The rule that matters in practice is that a name with a CNAME cannot have any other record of any type — so you cannot put a CNAME on the apex of your domain, because the apex must already carry NS and SOA records. That is why www.example.com can be a CNAME and example.com cannot, and why providers offer ALIAS, ANAME or “CNAME flattening” to fake the effect at the apex.
The record types you will actually meet
| Record | Question it answers | Value it holds |
|---|---|---|
| A | What IPv4 address serves this name? | 93.184.216.34 |
| AAAA | What IPv6 address serves this name? | 2606:2800:220:1:248:1893:25c8:1946 |
| CNAME | What other name should I look up instead? | target.example.net. |
| MX | Which server takes email for this domain? | 10 mail.example.com. |
| NS | Which name servers are authoritative here? | ns1.example.com. |
| TXT | What arbitrary text is published here? | v=spf1 include:_spf.google.com ~all |
| SOA | Who owns this zone and how should it be cached? | Serial, refresh, retry, expire, minimum |
| SRV | Which host and port run this service? | _sip._tcp 10 60 5060 sip.example.com. |
| CAA | Which certificate authorities may issue for this name? | 0 issue "letsencrypt.org" |
The coexistence rule, stated exactly
| At one name | Allowed? | Why |
|---|---|---|
| A + AAAA | Yes | Different address families for the same host |
| A + TXT | Yes | TXT carries verification strings, not addressing |
| A + MX | Yes | A web server and a mail route can share a name |
| CNAME + anything else | No | RFC 1034: a CNAME replaces the name entirely |
| CNAME at the zone apex | No | The apex must carry NS and SOA |
| CNAME at a subdomain | Yes | Nothing else is required to exist there |
| CNAME pointing at a CNAME | Legal but discouraged | Each hop costs a lookup; resolvers cap the chain |
What to use, when
| You want to | Use |
|---|---|
| Point www at a hosting platform that gives you a host name | CNAME on www |
| Point your root domain at a platform that gives you a host name | ALIAS/ANAME, or the platform's A records |
| Point a name at a fixed server you control | A record (plus AAAA if you have IPv6) |
| Verify ownership with Google, Microsoft or a SaaS tool | TXT record, occasionally a CNAME they specify |
| Send visitors from an old domain to a new one | HTTP 301 redirect, not DNS |
| Restrict which CA may issue certificates for you | CAA record |
Whatever you change, the wait afterwards is set by the TTL on the record you replaced, not by how fast your provider applies the edit.
Sources: IETF RFC 1034 and RFC 1035 (domain names), RFC 2181 (clarifications to the DNS specification), RFC 5321 (SMTP) and RFC 7505 (null MX).
Check your own numbers
See which of a domain's names are aliases and which resolve directly.
Frequently asked
Why does my DNS provider refuse a CNAME on the root domain?
Because the root of your zone already has NS and SOA records, and RFC 1034 forbids a CNAME from coexisting with any other record at the same name. It is not a limitation of your provider - a zone that broke that rule would be rejected or would resolve inconsistently. Providers that appear to allow it are running ALIAS or CNAME flattening, which resolves the target on their side and publishes a normal A record.
Is a CNAME slower than an A record?
Marginally, and almost never enough to notice. A CNAME costs the resolver one extra step because it must look up the target after following the alias, though most authoritative servers return both in a single response. Chained CNAMEs - an alias pointing at another alias - are the version worth avoiding; each hop is another round trip and resolvers cap how many they will follow.
Can an MX or NS record point at a CNAME?
No. RFC 2181 is explicit that MX and NS targets must be real host names with address records, not aliases. Doing it anyway produces intermittent failures: some senders and resolvers follow the alias, others treat the record as broken, and you end up debugging a fault that only affects some of your correspondents.
What is the difference between CNAME and a redirect?
A CNAME operates in DNS and is invisible to the browser - the address bar keeps showing the name you typed, and the target server must be configured to answer for it. A redirect operates in HTTP, returns a 301 or 302, and changes the address bar. If you want visitors to end up on a different URL, you want a redirect; if you want a different server to answer for the same URL, you want a CNAME.
Related answers
Need domain and DNS checks inside your own product?
We build WHOIS, RDAP, DNS and SSL lookups as embeddable widgets or a plain JSON API in your branding, wired to your own lead form. Tell us which checks you need and we will send a working demo.
Request received
Thanks — we will reply within one business day. Meanwhile, all 164 tools are free to use, no signup.