What is DNS?
DNS is like a phone book for the internet. It turns a website name into a number that computers understand. Each line in this phone book is a record.
The main domain, like example.com, is called the root or apex domain. A name with something in front, like blog.example.com, is a subdomain.
What is a CNAME record?
CNAME stands for canonical name. It makes one name an alias, or nickname, of another name. For example, www.example.com can be a nickname for example.com.
When someone visits the nickname, DNS looks up the real name and uses its answer.
Key rule: a CNAME cannot sit at the root domain. The root also needs other records, like those for email, and a CNAME cannot share a name with other records.
What is an ALIAS record?
An ALIAS record does a similar job, but it is allowed at the root domain. It is not an official DNS standard. Some DNS providers offer it under names like ALIAS or ANAME. The provider looks up the target for you and hands out the number, so it looks like a normal record to visitors.
Side by side
| Feature | CNAME | ALIAS |
|---|---|---|
| Works at root domain | No | Yes |
| Works on subdomains | Yes | Usually yes |
| Official standard | Yes | No, a provider feature |
| Available everywhere | Yes | Only at some DNS providers |
Which should you use?
- If you are pointing a subdomain such as
wwworshopto another name, use a CNAME. - If you must point the root domain to a name, not a number, use an ALIAS if your DNS provider has one.
- If your provider has no ALIAS, use an A record with the number given by your service.
Quick recap
- Both records point one name to another name.
- A CNAME is standard but cannot be used at the root domain.
- An ALIAS can be used at the root, but only where the provider supports it.
- Use CNAME for subdomains and ALIAS for the root when available.