How to add DNS records: A, CNAME, MX and TXT
DNS is the address book for your domain. It tells browsers where the website lives and email systems where to deliver messages. Use this guide to update records while keeping your current DNS provider.
If you are changing the DNS provider too, follow the nameserver change checklist. Connecting a website to new hosting may only require changing its records.
One domain can use separate records for web, email and verification.
Example: example.com. Each record stores a destination or information for one task.
- A → Website
Points the domain to the IPv4 address of your hosting service.
- MX → Incoming email
Directs messages to your email provider’s mail server hostname.
- TXT → Verification
Carries domain ownership or email sender verification information.
CNAME points to another name; AAAA points to an IPv6 address supported by the service.
Before you start
Prepare these items:
- Access to the account that manages your DNS records.
- The correct hosting IP address from your service information in the DCHost customer portal.
- Records supplied by your email provider.
- A copy of existing records: name, type, value and TTL. TTL is how long an answer may be cached.
Do not copy the examples: example.com and 192.0.2.10 are not settings for your service. Replace them with your own details when performing checks.
1. Find the authoritative DNS provider
The company where you registered the domain, your DNS provider and your hosting provider can be different. Make the change in the DNS panel your domain actually uses.
- Check the nameserver details in your domain account. A nameserver is a server that answers DNS queries.
- If your computer has
dig, check with this read-only query. Replaceexample.comwith your domain:
dig NS example.com +short
- Compare the result with the nameservers in your domain account.
- If cPanel manages the authoritative DNS, open Zone Editor and choose Manage beside the domain. If another provider manages DNS, open its record editor.
Check: A record appearing in cPanel does not prove that cPanel controls public DNS answers. Confirm the provider before editing if you are unsure.
2. Choose the record for the task
Find your task in the table. Obtain the new value from the service named in the last column.
| Task | Record | Where the value comes from |
|---|---|---|
| Point the website to an IPv4 address | A | Hosting service details; example format: 192.0.2.10 |
| Point the website to an IPv6 address | AAAA | The assigned IPv6 address, if your service supports IPv6 |
Point a name such as www to another name | CNAME | The destination hostname, not an IP address |
| Route incoming email | MX | The email provider's server names and priorities |
| Verify domain ownership or email senders | TXT | The value supplied for your account by that service |
Domain or subdomain? example.com is the root domain; www.example.com and mail.example.com are subdomains. IPv4 and IPv6 are two different internet address formats.
Many panels use @ for the root domain. Some append the domain automatically. Check the full name after saving so that you do not create a duplicated name such as www.example.com.example.com.
3. Change only the records you need
- Find the record in the DNS editor. In cPanel Zone Editor, use Edit for an existing record or Add Record for a new one.
- Enter the name, type, TTL and destination. For another provider, use the equivalent fields in its editor.
- Read the complete name and destination again. For a new website, the root domain's A record should point to the hosting IP. Configure
wwwwith the A or CNAME record appropriate for your service. - Save only the required changes. Do not remove every record.
CNAME check: Do not combine a CNAME with other record types at the same name. For the root domain, follow the provider's supported method instead of adding a standard CNAME.
IPv6 check: An old AAAA record can send some visitors to the old server. Check A and AAAA together. Do not add an AAAA record without confirming IPv6 support.
Email check: When moving only the website, preserve working MX, SPF, DKIM and DMARC records. The last three help authenticate email senders. If MX points to mail.example.com, check that name's A/AAAA records too. If MX points to the root domain itself, a web IP change can affect mail. An MX target must be the provider's mail server hostname, not an IP address or CNAME alias.
4. Verify both DNS and the service
Saving a panel entry and verifying a service are separate checks.
- Save the old record
Keep the name, type, value and TTL in case you need to restore it.
- Change the required record
Edit and save only the record needed for your task.
- Query the DNS answer
Does the lookup result match the new destination?
- Test the service
Open the site over HTTPS; send and receive email if mail records changed.
Previously cached answers may remain visible for their old TTL.
Check the record first, then the website or email service. Correct DNS does not rule out a separate application problem.
- If your computer has
dig, query the records below. Replace eachexample.comwith your domain. These commands do not change settings:
dig A example.com +short
dig AAAA example.com +short
dig CNAME www.example.com +short
dig MX example.com +short
dig TXT example.com +short
- Compare the answers with your intended destinations. If you do not use
dig, select the same record types in your DNS provider's lookup tool. - Open the root domain and
wwwusinghttps://. - If mail records changed, send a test message to an external account and receive its reply.
Still seeing the old value? TTL is how long a DNS answer may stay cached. Lowering it afterwards does not immediately erase previously cached answers. There is no fixed moment when every network updates.
Expected result and common errors
| What you see | What to check first |
|---|---|
| The panel shows the new value but lookups show the old one | Authoritative DNS provider and the previous TTL |
| The website still opens on the old server from some networks | A and AAAA records, the www target and caches |
| The website works but incoming email does not | MX target, its A/AAAA record and the email provider |
| Domain verification fails | The TXT record's complete name and exact value |
A successful change returns the intended DNS target and the relevant service works. Correct DNS alone does not prove that the web server or mailbox is configured.
Rollback
If you entered the wrong destination, restore only the changed record to its saved value. Do not reset the entire DNS zone. Cache lifetimes also apply to a reverted record.
Related guides
- Preserve website and email settings when changing nameservers
- Verify SPF, DKIM and DMARC
- Troubleshoot SSL and HTTPS