CNAME Records
A CNAME (Canonical Name) record creates an alias from one domain name to another. The DNS lookup will continue for the destination domain.
How CNAME Records Work
When a client queries a CNAME record, the DNS server responds with the canonical name and then the client must perform another lookup for that canonical name.
CNAME Record Format
blog.example.com. CNAME hashnode.network. shop.example.com. CNAME shops.shopify.com.
When to Use CNAME
- Pointing a subdomain to a third-party service (blog, shop, etc.)
- Creating aliases for CDN domains
- Mapping multiple hostnames to the same server
CNAME vs A Record
| CNAME | A Record |
|---|---|
| Points to a domain name | Points to an IP address |
| Requires additional lookup | Direct resolution |
| Can only be used for subdomains | Can be used for any name |
| Cannot coexist with other records* | Can have other records |
* A CNAME cannot coexist with other records at the same name (except DNSSEC)
Best Practices
- Don't use CNAME at the root domain (example.com) for your main website
- Ensure the target domain always resolves
- Test with our CNAME Lookup tool
Try it on your domain
See the theory in practice — run a CNAME Lookup for your own domain.