CNAME records
This guide explains when to use a CNAME record, how to add one for www, and the rules that stop it from breaking other records.
Before you begin
- The DNS case for your domain. See Find your DNS provider.
- The target name your service gave you, such as the main domain name. Copy it exactly.
- A check that the host name does not already have an A record, MX record or TXT record in the same zone.
Steps
Open the DNS editor at your DNS provider.
Add the record using the example below, replacing the target with the name your service gives you:
Type Host Value TTL CNAME www yourdomain.com. 3600 Save the change and wait for it to spread.
Check the result with
dig CNAME www.yourdomain.com +short. The answer should show the target.
A CNAME cannot share a name with other records
A host name that has a CNAME cannot also have other records, such as an A, MX or TXT record. Also, you cannot place a CNAME on the bare domain (@) in most DNS panels. Use an A record for the bare domain.
Expected result
The www name resolves to the same place as your target, and the site opens with or without www.
If something goes wrong
- The DNS editor rejects the record. Another record already uses the same host name. Remove the conflicting record or use an A record instead.
- The site works without
wwwbut not with it. Check that the CNAME target is correct and that it has a valid answer.
Related articles
Last reviewed
2026-10-27
