DNS Records: A, CNAME, MX and Debugging Tips
What A, AAAA, CNAME, MX, and TXT records do and how to look them up when debugging domains and email.
When you type google.com into your browser, a complex chain of events occurs to translate that human-readable name into an IP address such as 203.0.113.10 (a reserved documentation address, used here as a placeholder). This system is DNS.
Common Record Types
A Record (Address)
Maps a domain name to an IPv4 address. This is the most fundamental record.example.com → 203.0.113.10
CNAME (Canonical Name)
Maps one domain name to another domain name (an alias).www.example.com → example.com
MX (Mail Exchange)
Specifies the mail servers responsible for accepting email on behalf of the domain.
TXT (Text)
Originally for human-readable notes, now heavily used for verification (Google Search Console, SPF records for email security).
Propagation and Caching
DNS records are cached at multiple layers (browser, OS, router, ISP) to improve speed. When you change a record, old answers can linger in those caches until their TTL expires, which is what people call "propagation". It can be minutes or up to a day or two, depending on the TTLs involved (see the TTL section below).
Additional Record Types
AAAA Record
The IPv6 equivalent of an A record. Maps a domain to an IPv6 address (128-bit, longer format).example.com → 2001:0db8:85a3:0000:0000:8a2e:0370:7334
NS Record (Name Server)
Specifies which name servers are authoritative for the domain. These are the servers that hold the actual DNS records.
SOA Record (Start of Authority)
Contains administrative information about the domain, including the primary name server, administrator email, serial number, and refresh intervals.
PTR Record (Pointer)
Used for reverse DNS lookups, mapping IP addresses back to domain names. Mail servers often check it when deciding whether to trust a sender.
SRV Record (Service)
Specifies the location of services (like SIP, XMPP) running on a domain. Each record carries a priority, weight, port number and target host.
DNS Resolution Process
When you visit a website, DNS resolution happens in several steps:
- Browser Cache: Check if the domain was recently resolved
- OS Cache: Check the operating system's DNS cache
- Router Cache: Check your router's DNS cache
- Recursive Resolver: Query your configured resolver, often your ISP's or a public one such as 8.8.8.8
- Root Name Servers: If not cached, query root servers for TLD information
- TLD Name Servers: Query top-level domain servers (.com, .org, etc.)
- Authoritative Name Servers: Query the domain's authoritative name servers
- Return IP Address: The IP address is returned and cached at each level
This entire process typically takes milliseconds due to caching, but the first request can take longer.
DNS Security
DNSSEC (DNS Security Extensions)
Adds cryptographic signatures to DNS records so that validating resolvers can detect forged or altered answers. It does not encrypt anything, and it has to be enabled both at your DNS provider and at the registrar (which publishes the DS record).
DNS over HTTPS (DoH) / DNS over TLS (DoT)
Encrypts DNS queries between your device and the resolver, so other parties on the network path cannot read the lookups. The resolver operator still sees them, and the IP addresses you connect to afterwards remain visible. It also complicates network monitoring and filtering.
Common DNS Issues
Propagation Delays
When you change DNS records, it can take time for changes to propagate worldwide. This is due to TTL (Time To Live) values that control how long records are cached. How long it takes depends mainly on the old record's TTL, and name server changes at the registrar can take longer (see the TTL section below).
CNAME Conflicts
A CNAME record cannot coexist with other record types (A, MX, TXT) for the same name. Per RFC 2181, only DNSSEC records may sit beside it. This is a common mistake when setting up subdomains.
Email Delivery Issues
Incorrect MX records can cause email delivery failures. Common issues include:
- Missing MX records (fallback to A record, which may not be a mail server)
- Incorrect priority values (lower numbers = higher priority)
- Pointing to non-existent or misconfigured mail servers
A Typical Zone, Record by Record
Here is a small but realistic set of records for a site with email. The addresses use documentation ranges and placeholder hostnames, so replace them with your provider's values. A trailing dot, as in example.com., marks a fully qualified name in zone-file syntax. Many dashboards add it for you, and some want it left off.
| Record | Name | Value | Purpose |
|---|---|---|---|
| A | @ | 203.0.113.10 | Root domain to an IPv4 address |
| CNAME | www | example.com. | Alias the www host to the root |
| MX | @ | 10 mail.example.com. | Where email for the domain is delivered |
| TXT | @ | v=spf1 include:_spf.mailprovider.example ~all | Declare which servers may send mail |
| TXT | _dmarc | v=DMARC1; p=none; rua=mailto:dmarc@example.com | Tell receivers how to treat failed mail |
| CAA | @ | 0 issue "letsencrypt.org" | Restrict which CAs may issue certificates |
Notice what is absent: nothing here is a CNAME at the root. That is deliberate, and the next section explains why.
TTL: What "Propagation" Really Is
Nothing is pushed across the internet when you edit a record. You change the answer on your authoritative name servers, and every resolver that already cached the old answer keeps serving it until that record's TTL (time to live, in seconds) runs out. So a record with a TTL of 3600 can be served stale for up to an hour after the change, and the "up to 48 hours" figure usually comes from long TTLs, or from changing name servers at the registrar, where the parent zone's delegation records have their own, often longer, TTLs.
The practical playbook for a planned migration:
- A day or more before the change, lower the TTL on the records you will edit (300 seconds is a common choice).
- Wait at least as long as the old TTL so every cache has picked up the short value.
- Make the change and verify against the authoritative servers.
- Once stable, raise the TTL again to cut query volume and lookup latency.
Failed lookups are cached too. A resolver that was told a name does not exist can remember that answer for a period governed by the zone's SOA record (RFC 2308), which is why a brand-new hostname sometimes stays unreachable for a while on a machine that queried it before you created it.
CNAME Rules and the Apex Problem
A CNAME says "this name is an alias for that name", so the resolver restarts the lookup at the target. That is why a name with a CNAME cannot hold other record types: the aliased name would have to be both an alias and a holder of its own data. The root of a zone (the apex, such as example.com) always has SOA and NS records, so it can never be a CNAME under the standard rules.
When a platform asks you to point your bare domain at a hostname, you have three options. Use the A and AAAA addresses they publish, use a provider-specific feature (often called ALIAS, ANAME or CNAME flattening) that returns addresses while behaving like a CNAME internally, or redirect the bare domain to www and put the CNAME on www. Those flattening records are vendor features, not DNS standards, so check your provider's documentation.
Two more rules to remember: an MX or NS target should be a hostname with its own address records, not an alias, and not a raw IP address. If a redirect from the bare domain is part of the plan, our post on URL redirects covers the status codes to use.
Email Records: MX, SPF, DKIM and DMARC
MX records only say where mail is received. Whether other servers trust mail that claims to come from your domain is handled by three TXT-based mechanisms:
- SPF (RFC 7208): a single TXT record on the domain listing the servers allowed to send for it, for example
v=spf1 include:_spf.mailprovider.example ~all. A domain must have only one SPF record. Two separate ones cause a permanent error, so merge them into one. - DKIM (RFC 6376): the sending server signs each message, and the public key is published as a TXT record at
selector._domainkey.example.com. Your mail provider gives you the selector and the value. - DMARC (RFC 9989, which replaced RFC 7489): a TXT record at
_dmarc.example.comthat sets the policy (none,quarantineorreject) and where to send reports. Start withp=noneto observe, then tighten.
A single TXT string is limited to 255 characters. Long values such as DKIM keys are split into several quoted strings in one record, and resolvers concatenate them. Most DNS dashboards do the splitting automatically.
Other Records Worth Knowing
- CAA: lists which certificate authorities may issue certificates for the domain. A certificate request from a CA not listed should be refused, which limits the damage from a mis-issued certificate.
- Wildcard records:
*.example.comanswers for any name that has no more specific record. A wildcard does not match names that already exist with other record types, which surprises people. - Reverse DNS (PTR): lives in the
in-addr.arpazone for IPv4 and is controlled by whoever owns the IP block, usually your hosting provider, not your domain registrar. Mail servers often check it.
Querying DNS from the Command Line
dig is the standard tool on macOS and Linux. These forms cover most debugging:
dig example.com A +short # just the answer
dig example.com MX # full response including TTL
dig @8.8.8.8 example.com TXT # ask a specific resolver
dig NS example.com +short # which servers are authoritative
dig @ns1.example.net example.com # ask an authoritative server directly
dig +trace example.com # walk root -> TLD -> authoritative
dig -x 203.0.113.10 # reverse lookupThe TTL column in a normal dig answer counts down as the resolver's cache ages, so asking the same resolver twice shows whether you are seeing a cached answer. Asking the authoritative name server directly shows what the zone actually contains. If you cannot use a terminal, the DNS and WHOIS lookup tool gives a quick look from the browser, though it queries through a normal resolver, so it can show cached answers rather than the authoritative ones. To clear your own machine's cache, use ipconfig /flushdns on Windows or sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder on macOS.
A Debugging Checklist
- Are you asking the right servers? Run
dig NSon the domain and compare it with the name servers shown at your registrar. A mismatch means you are editing a zone nobody queries. - Does the authoritative answer have the new value? If yes and you still see the old one, it is cache, and waiting out the TTL is the only cure.
- Is a CNAME hiding other records? Look for a CNAME on the same name as your MX or TXT record.
- Do both A and AAAA exist? An outdated AAAA record sends IPv6 users to an old server while IPv4 users see the right site.
- Is the problem DNS at all? If the name resolves correctly, move up the stack to TLS, redirects and the application. The URL Redirect Checker shows each hop, and the anatomy of a URL explains which part of an address DNS is responsible for.
Debugging DNS Issues
Is your site down, or is it just your local cache? Is your email not arriving because of a bad MX record? Here are common scenarios:
- Website not loading: Check A/AAAA records point to correct IP addresses
- Email not working: Verify MX records are correct and point to valid mail servers
- Subdomain issues: Ensure CNAME or A records are properly configured
- SSL certificate errors: Verify DNS records match certificate requirements
Use our DNS & WHOIS Lookup tool for a quick check from outside your own network. It runs the lookups on our server through a standard resolver, so it bypasses your local cache but not the resolver's, and answers can still be cached until their TTL expires. For the authoritative answer, use dig against the name server as shown above. The tool provides:
- A, AAAA, CNAME, MX, TXT, NS, SOA, CAA and PTR lookups (PTR needs an IP address)
- WHOIS information (domain registration details, expiration dates)
- Multiple record type queries in one request
Frequently Asked Questions
What is the difference between an A record and a CNAME?
An A record maps a name directly to an IPv4 address, while a CNAME maps a name to another name, which is then resolved itself. Use A (and AAAA) when you control the address, and CNAME when a provider owns the target and may change its IPs.
How long does DNS propagation take?
It depends on the TTL of the old record. Resolvers keep the previous answer until the TTL expires, so changes are often visible within minutes if the TTL was low, and may take many hours if it was set high or you changed name servers.
Why can't I put a CNAME on my root domain?
A CNAME cannot coexist with other records, and the root of a zone must carry SOA and NS records. Use A and AAAA records, or an ALIAS-style feature if your DNS provider offers one.
What does MX priority mean?
It is a number that ranks mail servers, and lower values are tried first. A server with priority 10 is preferred over one with priority 20, and the higher number acts as a backup if the first is unreachable.
How do I check DNS records for a domain?
Query one record type at a time, such as dig example.com MX +short, or paste the domain into an online lookup tool. Query the authoritative name server directly when you need to bypass caches.
Written by Kashyap Thakar
Spotted a mistake? Let me know
Try these tools
Use these tools alongside this guide