DNS A, CNAME, and MX records are the three most important record types in any domain's DNS zone: the A record points the domain to the server's IP address, the CNAME creates aliases for subdomains, and the MX record tells the internet which server receives email. Setting them up correctly from the start saves hours of unnecessary troubleshooting.
Whether you've just published a website, set up a business email, or added a new subdomain, this guide explains each record type, what it does, and how to configure it step by step in your hosting or registrar's DNS panel.
What Is the DNS Zone and Where Do You Edit It?
The DNS zone is the complete set of records that define how your domain behaves: which server it points to, which server receives email, which subdomains exist, and more.
The zone is edited on the server acting as your domain's authoritative DNS — usually your hosting provider, if you've pointed your nameservers there. In cPanel, you'll find it under Advanced DNS Zone Editor or DNS Zone Editor. Other control panels (Plesk, DirectAdmin, Cloudflare) use different names, but the logic is identical.
Practical rule: If your nameservers point to your hosting, edit the zone there. If your nameservers point to your registrar (GoDaddy, Namecheap, Neubox), edit the zone at the registrar.
A Record: Connect Your Domain to an IP Address
The A (Address) record is the most fundamental: it maps a domain name to an IPv4 address. It's what tells a browser "this domain lives on this server."
Structure of an A Record
| Name | Type | TTL | Value |
|---|---|---|---|
| yourdomain.com | A | 3600 | 203.0.113.10 |
| www | A | 3600 | 203.0.113.10 |
When to Create an A Record
- To point the root domain (
yourdomain.com) to your hosting server. - To point
wwwdirectly to an IP (though a CNAME works too). - To point subdomains to different servers — for example,
api.yourdomain.comto a separate backend server.
How to Create One in cPanel
- Open DNS Zone Editor.
- Click Add Record.
- In "Name", type the domain or subdomain (
@or leave blank for the root,wwwfor www). - Select type A.
- In "Address", enter your server's IP (found in your hosting welcome email or in cPanel's "Account Information").
- Leave TTL at 3600 and save.
CNAME Record: Aliases for Subdomains
A CNAME (Canonical Name) record creates an alias: instead of pointing to an IP address, it points to another domain name. The browser then resolves that name to find the final IP.
Structure of a CNAME Record
| Name | Type | TTL | Value (target) |
|---|---|---|---|
| www | CNAME | 3600 | yourdomain.com. |
| store | CNAME | 3600 | shops.myprovider.com. |
Note the trailing dot after the target — many panels add it automatically; in others you must type it yourself.
Common Uses for CNAME Records
wwwpointing to the root domain: if you change your server IP later, you only update the A record andwwwupdates automatically.- Subdomain for an external service:
store.yourdomain.com→ Shopify, Webflow, or any SaaS platform's servers. - Verification records for Google Search Console or Google Workspace: they give you a CNAME with a random name and value to prove domain ownership.
Important Rule: Never Use a CNAME at the Root Domain
A CNAME cannot be used for the root domain (yourdomain.com without a subdomain). The technical reason is that DNS RFCs prohibit it because it would break MX and SOA records. For the root, always use an A record (or ALIAS/ANAME if your provider supports them).
MX Record: Route Your Email
The MX (Mail eXchanger) record tells the internet which server receives emails sent to @yourdomain.com. Without it, no one can send you email at your own domain.
Structure of an MX Record
| Name | Type | Priority | Target |
|---|---|---|---|
| yourdomain.com | MX | 10 | mail.yourdomain.com. |
| yourdomain.com | MX | 20 | mail2.yourdomain.com. |
The "Priority" column sets the preference order: the lower number is tried first. The 20 acts as a backup if the primary server is unavailable.
MX Configuration for the Most Common Providers
Each email provider gives you its own MX values. The most common ones are:
- cPanel / shared hosting: usually pre-configured with
mail.yourdomain.comas the target, priority 0. - Google Workspace: five MX records pointing to
aspmx.l.google.comand similar, with priorities 1, 5, 5, 10, and 10. - Microsoft 365: one MX record pointing to
yourdomain-com.mail.protection.outlook.com, priority 0. - Zoho Mail: points to
mx.zoho.com(priority 10) andmx2.zoho.com(priority 20).
If you're unsure which DNS records you need for your email or website setup, the specialists at elenlace.com can audit and fix them quickly.
Additional Records You Should Know
TXT Records (SPF, DKIM, DMARC)
TXT records serve many purposes, but the most critical ones for email are:
- SPF: lists the servers authorized to send email on behalf of your domain. Reduces spam and prevents spoofing. Example:
v=spf1 include:_spf.google.com ~all - DKIM: a cryptographic signature that verifies an email wasn't altered in transit. Your provider will give you the exact value.
- DMARC: a policy that tells receiving servers what to do with emails that fail SPF or DKIM. Example:
v=DMARC1; p=quarantine; rua=mailto:[email protected]
AAAA Record
Same as an A record but for IPv6 addresses. If your server has an IPv6 address, create an AAAA record pointing to it. It's not required but improves future connectivity.
Summary Table: When to Use Each Record
| Record | What it does | Example use |
|---|---|---|
| A | Points domain/subdomain to an IPv4 address | yourdomain.com → 203.0.113.10 |
| CNAME | Creates a subdomain alias to another name | www → yourdomain.com |
| MX | Defines the incoming mail server | @ → mail.yourdomain.com |
| TXT | Verification and email authentication | SPF, DKIM, DMARC values |
| AAAA | Points to an IPv6 address | yourdomain.com → 2001:db8::1 |
For more guides on domain management, visit our domains blog where you'll find tutorials on transfers, WHOIS privacy, extensions, and more.
Common Mistakes When Configuring DNS Records
- CNAME at the root domain. It won't work. Always use an A record for
yourdomain.com. - Missing trailing dot on CNAME and MX targets. Many panels add it automatically; if yours doesn't and you omit it, the target may be misinterpreted.
- Duplicate A records with the same IP. This doesn't cause a visible error but clutters the zone. Delete duplicates.
- High TTL before a planned server change. If you know you're moving servers in 48 hours, lower the TTL to 300 a day in advance. The actual change will then propagate in minutes instead of hours.
- Not adding SPF after setting up external email. Without SPF, your outgoing emails will likely land in spam.
Key Takeaways
- The A record connects your domain or subdomain to an IPv4 address — the most fundamental DNS record.
- CNAME creates subdomain aliases to another domain name; never use it at the root domain.
- The MX record defines which server receives email for your domain; without it, no one can email you.
- TXT records (SPF, DKIM, DMARC) are essential to keep outgoing email out of spam folders.
- Edit the DNS zone on the authoritative server — if your nameservers point to hosting, edit it there.
- Lower TTL before a planned change to minimize propagation time.
Need someone to review or configure your DNS zone for you? The team at elenlace.com offers expert technical support for domains and hosting so your site and email work from day one.
FAQ
How long does it take for a new DNS record to take effect?
It depends on the record's TTL. With a TTL of 3600 (one hour), changes reflect across most of the world within 1–4 hours. If you lowered the TTL to 300 before making the change, propagation can happen in 5–10 minutes.
Can I have multiple A records for the same domain?
Yes. This is called DNS round-robin and is used to distribute traffic across multiple servers. DNS resolvers will alternate between the IP addresses for each query, providing a basic form of load balancing.
What happens if I have both a CNAME and an A record with the same name?
It creates a DNS conflict. Most control panels won't let you create it, but if it happens the behavior is unpredictable. Remove one: use only the A record if you need to point to an IP, or only the CNAME if you're pointing to another name.
Should I create an A record or a CNAME for "www"?
Either works. A CNAME pointing to yourdomain.com is more convenient because if you change your server's IP later, you only update the root A record and www updates automatically. That said, if your provider doesn't support a CNAME for www, an A record pointing to the same IP is perfectly valid.
Useful resources
Other providers and guides worth comparing: