# A record or CNAME: which one do you need?

> The difference in one sentence, the rule for picking, and the one combination that is never allowed.

Source: https://cwp.sg/tutorials/a-record-vs-cname/  
Author: Ben Johnson  
Last verified: 2026-09-21

**In short:** - An A record maps a name to an IP address. Use it when your host gives you an IP. - A CNAME maps a name to another name. Use it when your host gives you a hostname. - You cannot put a CNAME on the root domain (like `example.com`). Use an A record or an ALIAS record there. - A CNAME adds one extra DNS lookup. Avoid chains of CNAMEs pointing at other CNAMEs.

A records and CNAME records do different things. Pick the wrong one and your domain stops resolving. Here is how to decide in ten seconds.

**A record** maps a name to an IP address. **CNAME** maps a name to another name. If your host gives you an IP address like `198.51.100.1`, you want an A record. If your host gives you a hostname like `yourname.cwp.sg`, you want a CNAME.

That is the whole rule. The rest is detail.

## What each record actually does

An A record (address record) is the simplest DNS record. When someone types `www.example.com`, the A record tells their browser "that name lives at this IP". The browser connects directly. One lookup, one answer.

A CNAME (canonical name record) says "this name is really that name". When someone types `shop.example.com`, the CNAME says "go ask about `yourname.cwp.sg` instead". The resolver then looks up whatever record `yourname.cwp.sg` has — often an A record — and returns that IP. Two lookups instead of one.

CNAMEs are convenient when your host might change IPs. The host updates the A record for `yourname.cwp.sg`, and every CNAME pointing at it follows automatically. You never touch your DNS panel again.

## The root-domain rule that trips everyone up

You cannot put a CNAME on the root domain (often called the bare domain or apex domain, like `example.com` with nothing before it). The DNS standards forbid it. This is not a quirk of your provider — it is how the protocol works.

The root domain already has NS records (name servers) and SOA records (start of authority). A CNAME says "this name is an alias for another name", which means it must be the only record at that name. You cannot have both the CNAME and the NS records. So the root domain cannot use a CNAME.

Some DNS providers offer an ALIAS or ANAME record as a workaround. That is a proprietary trick that behaves like a CNAME at the root level. Your host will tell you if they support it and what they call it. If they do not, you use an A record at the root and a CNAME for `www`.

If you need the full step-by-step for any domain setup, read [the full domain guide](/guides/how-to-host-a-website/point-a-domain-to-your-host/).

## CNAME chains cost you time

Every CNAME adds one extra DNS lookup. A chain of two CNAMEs means three lookups total. That adds milliseconds, but if one link in the chain fails, your domain stops resolving.

Do not point a CNAME at another CNAME if you can avoid it. Point it at a record that has an IP address. Your DNS panel will not stop you from making a chain, but your visitors will feel the delay.

## When your host gives you an IP

Use an A record. This is common with shared hosting, VPS servers, and anything that runs on a fixed address.

The A record is faster (one lookup) and simpler. The risk is that if your host changes IPs, you must update the A record yourself. Some hosts keep the same IP for years. Others change it every few weeks. Ask your host whether their IP is stable before you commit.

## When your host gives you a hostname

Use a CNAME. This is common with CDNs, load balancers, and some free hosting providers. The host handles the IP changes. You point your CNAME at their hostname and forget about it.

Do not try to look up the IP from the hostname and use an A record instead. The IP can change without warning, and your site will go down.

## Verifying your record works

After you save the record, use [the DNS lookup tool](/tools/dns-lookup/) to check what your name currently resolves to. If you see the expected IP for an A record, or the expected hostname for a CNAME, you are set.

Remember that DNS changes take time to spread across the internet. Check [the propagation checker](/tools/dns-propagation-checker/) to see whether the change has reached servers around the world.

If you see a "DNS probe finished NXDOMAIN" error in your browser, that means the domain name is not resolving at all. Visit [the NXDOMAIN error page](/errors/dns-probe-finished-nxdomain/) for steps to fix it.

## Which record type you need for a CNAME or A address

Your host gave you an IP address. Use an A record at every name you need.

Your host gave you a hostname. Use a CNAME for every name you need, except the root domain. At the root domain, use an A record with the current IP, or an ALIAS/ANAME if your DNS provider offers one.

That is the whole decision. A record for addresses. CNAME for names. No CNAME at the root. Pick one and move on.

---

Content Website Platform (cwp.sg) operates the free hosting it writes about; see https://cwp.sg/about/ for the methodology and the commercial disclosure.
