A CNAME (canonical name) record is a DNS record that makes one hostname an alias of another hostname.
A CNAME record tells DNS that one name is really just another name in disguise. Instead of pointing at an IP address like an A record does, it points at a hostname, and the resolver then looks up that hostname to find the final address.
For example, you might set www.example.com as a CNAME for example.com. Or you might point shop.example.com at a hostname given to you by your online shop platform, like shops.provider.com. If the provider changes its servers, your subdomain follows automatically.
How a CNAME record works
- A visitor's browser asks for blog.example.com.
- DNS returns a CNAME saying "blog.example.com is an alias of example.ghost.io".
- The resolver then looks up example.ghost.io and gets its A record.
- The browser connects to that IP address.
This extra step usually adds very little time, because resolvers cache the answers for the length of each record's TTL.
CNAME vs A record
- A record: name to IP address. Use it when you control the server and know its IP.
- CNAME: name to another name. Use it when a service gives you a hostname, or when several subdomains should all follow one main record.
A good rule of thumb: if someone hands you an IP address, use an A record. If they hand you a hostname, use a CNAME.
CNAME rules and limitations
The DNS standards place a few important limits on CNAMEs:
- No other records on the same name. A name with a CNAME can't also have an MX, TXT or A record.
- Not on the root domain. Because the bare domain (example.com) must hold nameserver and SOA records, it can't be a CNAME. Some DNS providers offer workarounds called CNAME flattening or ALIAS records.
- Don't chain too many. A CNAME pointing to another CNAME works, but long chains slow lookups and are easy to break.
- MX records shouldn't point to a CNAME. Mail servers expect them to point at a name with an A record.
Common CNAME problems
- "CNAME and other data" error: you tried to add a CNAME where another record already exists. Remove the other record first, or use a different subdomain.
- Trailing dot confusion: some DNS editors need a full name with a dot at the end, and others add your domain automatically, leading to targets like shop.provider.com.example.com.
- SSL errors: the service you're pointing at needs to issue a certificate for your subdomain, which often happens only after the CNAME is live.
AblePage includes free DNS management, so you can add CNAME records for any domain you point at us.