When a hosting company tells you to "point your domain at us", they hand you one of two things: an IP address, or a hostname. That single detail decides which DNS record you create, and mixing them up is one of the most common reasons a freshly connected domain refuses to resolve.
This guide explains how the two record types differ, when each one is right, and the one place a CNAME is not allowed at all. Both types are among the ten the free DNS Record Formatter and Explainer on Ovatly recognises, so you can paste either record in and have it explained field by field.
Contents
- Quick answer
- What an A record does
- What a CNAME record does
- The decision: address given, or name given
- The apex problem: why the bare domain is different
- How to read either record with the formatter, step by step
- Worked example: one name, both ways
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
An A record points a name at an IPv4 address; a CNAME points a name at another name, which is then resolved in turn. Use an A record when your host gives you a fixed address, and a CNAME when they give you a hostname, so their address changes flow through automatically. A CNAME cannot sit at the zone apex (your bare domain) on standard DNS, which is why apex records are usually A.
What an A record does
An A record is the final answer in a lookup: this name lives at this IPv4 address. The example record:
shop.example.com. 300 IN A 203.0.113.10
The name shop.example.com. resolves directly to 203.0.113.10, and the resolver's job is done. There is nothing further to follow, which makes A records simple and fast to resolve. (Its sibling AAAA does the same job for IPv6 addresses.)
The weakness is baked into the strength: the address is written into your zone by hand, so if the service moves and the address changes, your record points at the old location until you edit it.
What a CNAME record does
A CNAME record is a pointer. It says: this name is another name for that one; go and ask again. The resolver follows the pointer, looks up the target name, and uses whatever address that lookup returns.
That indirection is exactly what hosted platforms want. A shop platform, a docs host or a website builder gives you a target hostname under their control. You point your subdomain at it once with a CNAME, and from then on they can move the service between addresses and your record keeps working, because it never contained an address to go stale.
The cost is one extra lookup, and a rule with teeth: a name that carries a CNAME cannot carry other record types alongside it, because the pointer claims the name entirely. That rule is what creates the apex problem below.
The decision: address given, or name given
You rarely choose freely; the host's instructions choose for you:
- They gave you an IP address (something like 203.0.113.10): create an A record with that address as the value.
- They gave you a hostname (something like shops.example-platform.com): create a CNAME with that hostname as the value.
- They gave you both for different names: that is normal. A typical setup is an A record for the bare domain and a CNAME for www pointing at the platform's hostname.
Guessing is the failure mode: putting a hostname into an A record's value field is invalid, and the formatter will flag a value that does not match its type, a cheap way to catch the slip before your provider saves it.
The apex problem: why the bare domain is different
Every zone apex must carry NS records naming its servers and an SOA record describing the zone. Since a CNAME cannot coexist with other records at the same name, it would collide with records that have to exist, so providers refuse it there.
In practice the bare domain is pointed with an A record to the host's address, while subdomains such as www are free to use CNAMEs. Some providers offer workarounds with names like ALIAS or ANAME that behave like a CNAME at the apex; those are provider extensions, not standard record types, and the formatter reports them as unrecognized, since they are not among the ten standard types it explains.
How to read either record with the formatter, step by step
- Copy the record line from your DNS provider's panel, a zone file, or dig output.
- Open the DNS Record Formatter and Explainer and paste the line in. It accepts dig order and zone-file order.
- Read the explanation: confirm the type field says A or CNAME, and check the value. For an A record it should be an IPv4 address; for a CNAME, a hostname.
- Check the value against what your host gave you. A single wrong digit or character sends traffic nowhere.
- Make the change at your provider, then paste the new record back into the tool to confirm it is valid.
Worked example: one name, both ways
The A record version of the shop:
shop.example.com. 300 IN A 203.0.113.10
And the CNAME version of the same name, pointed at a platform host:
shop.example.com. 300 IN CNAME shops.example-platform.com.
Both lines have the same shape: name, TTL 300, class IN, then the type, then the value. Only the last two fields differ. With the A record, a visitor's resolver gets 203.0.113.10 and connects. With the CNAME, the resolver is told to look up shops.example-platform.com. instead, and connects to whatever address that name currently holds. If the platform moves the shop next month, the CNAME setup follows on its own; the A record setup waits for someone to edit it.
Limitations and honest tradeoffs
The formatter explains records you paste and validates their values. It never queries live DNS and never makes a change, so it cannot tell you which record the world currently sees for your domain, or whether your provider accepted an edit. Confirm the live state through your provider after changing anything.
Both sides carry genuine costs. A CNAME adds a lookup step and cannot be used at the apex or alongside other records at the same name. An A record is direct and apex-safe but freezes an address that someone else controls. Neither is universally better; the host's setup decides.
And a freshly edited record of either type still waits for old cached answers to expire before the change is visible everywhere.
Common mistakes
- Creating an A record with a hostname as the value. The value of an A record must be an IPv4 address; a hostname belongs in a CNAME.
- Trying to add a CNAME at the bare domain. Standard DNS forbids it there; use an A record.
- Adding other records to a name that already has a CNAME. The pointer claims the name exclusively, so they conflict.
- Assuming a CNAME is a redirect. It is not. A CNAME changes which address a name resolves to; it never changes the URL in a visitor's browser.
- Editing the record without reading it first. Paste the current line into the formatter and read the fields before replacing it.
FAQs
What is the difference between a CNAME and an A record? An A record maps a name directly to an IPv4 address. A CNAME maps a name to another name, and the resolver then looks up that second name to find the address. One is the final answer; the other is a pointer to where the answer lives.
Which record should I use if my host gave me an IP address? An A record. The address goes in the record's value field, and the name resolves straight to it with no extra lookup.
Which record should I use if my host gave me a hostname? A CNAME. Pointing at the hostname means the host can move the service to a different address behind that name and your record keeps working untouched.
Why can I not use a CNAME for my bare domain? On standard DNS a CNAME cannot coexist with the other records a zone apex must carry, such as NS and SOA, so providers do not allow it there. The apex is normally pointed with an A record instead.
Can this tool check which record I currently have? It explains records you paste and validates their values, but it never queries live DNS. Paste the record from your provider's panel or dig output and it will show you the type and value in plain words.
Conclusion
The A versus CNAME question answers itself once you look at what your host handed you: an address means an A record, a name means a CNAME, and the bare domain takes an A record because a CNAME cannot live at the apex. Whichever you are about to edit, paste it into the DNS Record Formatter and Explainer first and read it in plain words. The other field worth understanding before any change is the caching window, covered in our guide to what TTL is and how long it should be. More guides are in the Website and Webmaster Tools guides.
References
- Cloudflare Learning Center, on the difference between CNAME and A records: https://www.cloudflare.com/learning/dns/dns-records/dns-cname-record/
- RFC 1035, the DNS specification that defines the A and CNAME record types: https://www.rfc-editor.org/rfc/rfc1035