How Does a CNAME Record Work?
- User enters www.example.com.
- DNS checks the CNAME record.
- The CNAME points to example.com.
- DNS resolves the A or AAAA record of the destination.
- The browser connects to the correct server.
www.example.com → example.com
CNAME Record Example
| Host | Record Type | Value |
|---|---|---|
| www | CNAME | example.com |
| blog | CNAME | blog.hostingprovider.com |
| shop | CNAME | ecommerce.example.net |
CNAME vs A Record
| Feature | CNAME | A Record |
|---|---|---|
| Points to | Hostname | IPv4 Address |
| Uses IP | No | Yes |
| Best For | Aliases & Subdomains | Main Domain |
When Should You Use a CNAME?
- www subdomains
- Blogs
- CDN integration
- SaaS applications
- Cloud hosting
- Website verification
When Should You NOT Use a CNAME?
- Root domain (in most DNS providers)
- MX records
- Nameserver records
- Direct IP mapping
Advantages
- Easy DNS management
- No need to update multiple IP addresses
- Ideal for cloud services
- Simplifies website migrations
Disadvantages
- Extra DNS lookup
- Usually cannot be used on the root domain
- Depends on the target hostname
How to Create a CNAME Record
- Log in to your DNS panel.
- Open DNS Management.
- Add a new record.
- Select CNAME.
- Enter the host (e.g. www).
- Enter the destination hostname.
- Save the record.
- Wait for DNS propagation.
Common Errors
- CNAME Loop
- Incorrect Target
- Conflicting Records
- DNS Propagation Delay