A CNAME record (short for "Canonical Name") is a type of DNS record that points one domain or subdomain to another domain name, rather than directly to an IP address. Instead of saying "this subdomain lives at this server," a CNAME record says "this subdomain is just another name for that other domain, go look up its address instead."
What a CNAME Record Actually Does
Every domain name eventually has to resolve to an IP address so a browser or email server knows where to connect. A CNAME record doesn't provide that address directly. It tells DNS to follow the chain to a different hostname first, and that hostname's own records (usually an A or AAAA record) provide the actual address.
For example, a record like shop.yourdomain.co.ke CNAME storefront.someplatform.com means anyone visiting shop.yourdomain.co.ke is redirected, at the DNS level, to wherever storefront.someplatform.com currently points. If that platform changes its servers later, you don't have to update anything on your end.
When You'd Actually Need One
- Pointing a subdomain (like www or shop) to a third-party platform, such as an e-commerce tool, landing page builder, or help desk widget, without needing to know their IP address.
- Verifying domain ownership for a service (Google Workspace, an email marketing tool, a CDN) when they ask you to create a specific CNAME record as proof you control the domain.
- Pointing a subdomain at a CDN or asset-hosting service so traffic routes through their network.
- Making www.yourdomain.co.ke follow whatever your root domain (yourdomain.co.ke) currently points to, so you only ever have to update one record when your hosting changes.
Rules and Limitations to Know
CNAME records come with a few strict rules that trip people up:
- A CNAME can't share a name with any other record. If shop.yourdomain.co.ke has a CNAME record, it can't also have an A, MX, or TXT record. DNS doesn't allow it, and most zone editors will refuse to save it.
- A CNAME can't be used at the root (apex) domain. You can't point yourdomain.co.ke itself (without a subdomain prefix) using a CNAME, because the root domain almost always needs other records, like MX for email, alongside it. If you need the root domain itself to follow another hostname, look at an ALIAS or ANAME record instead, which some DNS providers offer as a workaround.
- It adds a small lookup step. Resolving a CNAME takes one extra step compared to an A record, which is rarely noticeable but worth knowing if you're troubleshooting slow DNS resolution.
How to Add a CNAME Record
The exact screen differs slightly depending on which control panel your hosting account uses.
In cPanel
- Log in to cPanel and open Zone Editor under the Domains section.
- Find the domain you want to edit and click Manage.
- Click Add Record and choose CNAME as the record type.
- Enter the subdomain name in the Name field (for example, "shop") and the destination hostname in the CNAME or Record field, ending with a full stop if the field requires it (e.g. storefront.someplatform.com.).
- Leave the TTL at its default value unless a specific service asked you to lower it, then click Save Record.
In DirectAdmin
- Log in to DirectAdmin and open DNS Management (sometimes labeled DNS Administration) for the relevant domain.
- Find the option to add a new record and select CNAME as the type.
- Enter the subdomain name and the destination hostname exactly as instructed by the service you're setting up.
- Click Add Record (or Save) to apply it.
Double-check the destination hostname for typos before saving. A CNAME pointing to a hostname that doesn't exist, or that you entered incorrectly, will make the subdomain unreachable until it's fixed, and DNS changes can take a little time to update everywhere once corrected.
If you're trying to point your root domain somewhere else instead of a subdomain, see What Is an ALIAS/ANAME Record and When Do You Need One? for the workaround.