# CNAME vs A record

> The difference between A and CNAME records, when to use each, and why your root domain can't be a CNAME.

Source: https://helpcenter.ruachost.com/domains/dns/cname-vs-a-record/

Both records point a name somewhere, but in different ways.

| | A record | CNAME record |
| --- | --- | --- |
| Points to | An **IP address**, e.g. `192.0.2.10` | **Another name**, e.g. `example.com` or `shops.myshopify.com` |
| Use it for | Your domain itself (`@`) and subdomains on your own server | Subdomains such as `www`, `shop` or `blog` that should follow another name |
| If the target changes | You must update the IP yourself | It updates automatically, because it follows the other name |
| Can share its name with other records? | Yes | No. A CNAME must be the only record for that name |

## When to use an A record

- Pointing `example.com` (`@`) to your Ruachost hosting or another server
- When a service gives you an **IP address**

## When to use a CNAME

- Making `www.example.com` follow `example.com`
- When a service gives you a **hostname**, for example `shop` → `shops.myshopify.com`

## Why `@` can't be a CNAME

Your root domain (`example.com`) must have other records, such as NS, SOA, MX for email and TXT for SPF. A CNAME can't share its name with any other record, so the root domain can't be a CNAME. Use an **A record** for `@`, and a **CNAME** for `www`.

Some DNS providers offer an **ALIAS** or **ANAME** record, which works like a CNAME at the root. Ruachost DNS doesn't use these. If a platform asks for one, use the A record it also provides, or point `www` with a CNAME and [redirect](https://helpcenter.ruachost.com/domains/guides/managing-the-domain-forwarding-service/) the root domain to `www`.

## Related articles

- [Managing DNS records](https://helpcenter.ruachost.com/domains/dns/dns-resource-records/)
- [My domain works without www but not with it](https://helpcenter.ruachost.com/domains/dns/domain-works-without-www/)
