# Setting Up CNAME Records for Subdomains

Source: https://support.kapsulehost.com/en-nz/cname-records

A CNAME (Canonical Name) record maps one domain name to another. It is commonly used to point a subdomain to a third-party service, such as `shop.yourdomain.com` pointing to your Shopify store, or `mail.yourdomain.com` pointing to Google Workspace.

### When to Use a CNAME Record

- Pointing a subdomain to an external service (Shopify, Squarespace, HubSpot, etc.)
- Creating a `www` alias that points to the root domain
- Verifying domain ownership with a third-party service (see [Domain Verification Records](https://support.kapsulehost.com/en-nz/domain-verification-records))

### Adding a CNAME Record in KPanel

1. Log in to KPanel at [kpanel.kapsulehost.com](https://kpanel.kapsulehost.com)
2. Go to **Domains** and select your domain
3. Click **DNS Records**
4. Click **Add Record**
5. Set the type to **CNAME**
6. Enter the subdomain in the **Name** field (for example, `shop` for `shop.yourdomain.com`)
7. Enter the target domain in the **Value** field (for example, `shops.myshopify.com`)
8. Click **Save**

### CNAME vs A Record

| Use Case | Record Type |
|----------|-------------|
| Pointing to an IP address | A record |
| Pointing to another domain name | CNAME |

If a third-party service gives you an IP address, use an [A record](https://support.kapsulehost.com/en-nz/dns-basics). If they give you a domain name, use a CNAME.

### The www Subdomain

Many websites point `www.yourdomain.com` to the same place as `yourdomain.com`. This can be done with a CNAME:

| Type | Name | Value |
|------|------|-------|
| CNAME | www | yourdomain.com |

> **Tip:** When you [add a domain to a website](https://support.kapsulehost.com/en-nz/custom-domain-for-website) in KPanel, the `www` CNAME is created automatically. You only need to add it manually if you are managing DNS at an external provider.

### CNAME Restrictions

There are a few technical limitations to be aware of:

- You **cannot** use a CNAME for the root domain (the bare `@` or `yourdomain.com`). Use an A record for this.
- You **cannot** have a CNAME alongside other record types (such as MX or TXT) for the same name.

### Checking Propagation

After adding a CNAME, it can take up to a few hours to propagate worldwide. To check the current value, visit [dnschecker.org](https://dnschecker.org), enter your subdomain, and select CNAME as the record type.
