DNS record types explained: A, CNAME, MX, TXT, and when to use each
TL;DR: DNS records are not interchangeable, each type answers a genuinely different, specific question about a domain: an A record maps a domain or subdomain directly to a server's IP address, a CNAME record maps a domain or subdomain to another domain name rather than directly to an IP, an MX record specifies where mail for the domain should be routed, and a TXT record holds arbitrary text used for a range of verification and policy purposes (SPF, DKIM, DMARC, and various site-ownership verification methods). Understanding which record type actually answers which question is the foundation for correctly configuring anything from a basic website pointing to email authentication, and confusion between types is behind a meaningful share of the DNS-related problems covered across our other guides.
Why record type matters, not just the value
DNS is often discussed as if configuring it is simply a matter of "pointing your domain at the right value," which glosses over a genuinely important distinction: the specific record type used determines what kind of question is being answered and how a requesting system should interpret the returned value, and using the wrong record type for a given purpose, even with an otherwise correct-looking value, produces incorrect or entirely non-functional results, which is why understanding the specific purpose of each type matters more than treating DNS configuration as a single, undifferentiated task.
A record: pointing directly to an IP address
An A record maps a domain or subdomain directly to an IPv4 address, the specific, numeric address of the actual server that should handle requests for that domain, covered in the general context of pointing a domain to hosting in our dedicated guide. This is the most fundamental record type for making a website actually reachable at a given domain, telling requesting systems exactly which physical server to connect to. An AAAA record serves the equivalent purpose specifically for IPv6 addresses, the newer, longer-format IP addressing standard, relevant if your hosting infrastructure supports IPv6 connectivity.
CNAME record: pointing to another domain name
A CNAME (Canonical Name) record maps a domain or subdomain to another domain name, rather than directly to an IP address, meaning a request for the CNAME'd domain is redirected at the DNS level to resolve whatever the target domain name itself resolves to, useful specifically when you want a subdomain to always follow wherever another domain currently points, without needing to update the subdomain's own record every time the target's underlying IP address might change. This is commonly used for things like pointing a www subdomain at your root domain, or configuring a subdomain to point at a third-party service (a CDN, an email marketing platform's tracking domain) whose own underlying IP address you do not control and which may change without notice on their end.
A CNAME record cannot coexist with other record types at the same specific subdomain (a domain cannot have both a CNAME and an MX record at the same exact name, for example), a specific technical constraint worth being aware of since it explains certain configuration conflicts that can otherwise seem confusing.
MX record: where mail gets routed
An MX (Mail Exchange) record specifies which mail server(s) should receive email addressed to the domain, along with a priority value determining the order mail servers should be attempted if multiple are listed, covered in depth in our dedicated MX record diagnosis guide. This is entirely separate from and independent of the A record governing your website, meaning changing one has no effect on the other, a distinction worth being clear on given how often confusion between website and email configuration causes real, practical problems during migrations.
TXT record: arbitrary text for verification and policy
A TXT record holds arbitrary text content associated with a domain, a flexible format used for a wide range of purposes beyond any single specific function: SPF records (covered in our dedicated guide) authorizing which servers may send email on the domain's behalf, DKIM records enabling email signature verification, DMARC records (covered in our dedicated guide) specifying email authentication policy, and various site-ownership verification methods (including the Search Console DNS verification covered in our dedicated guide) that rely on placing a specific, provider-issued text string in a TXT record to prove domain control. A single domain commonly has multiple TXT records simultaneously, each serving a different one of these distinct purposes, all coexisting without conflict since TXT records are specifically designed to hold this kind of varied, purpose-specific content.
Other record types worth knowing
NS records specify which nameservers are authoritative for the domain, the foundational record type determining where all other DNS queries for that domain are actually directed and answered from. SRV records specify the location of a specific service (used by certain applications and protocols that need more structured service-location information than a simple A or CNAME record provides). CAA records specify which certificate authorities are authorized to issue SSL certificates for the domain, an additional security control worth being aware of, relevant to the certificate issuance process covered in our dedicated SSL certificate types guide.
A comparison table
| Record type | What it specifies | Common use case |
|---|---|---|
| A / AAAA | Direct IP address mapping | Pointing a domain to a web server |
| CNAME | Alias to another domain name | www subdomain, third-party service integration |
| MX | Mail server routing and priority | Email delivery configuration |
| TXT | Arbitrary text content | SPF, DKIM, DMARC, site verification |
| NS | Authoritative nameservers | Determines where all DNS queries for the domain are answered |
| CAA | Authorized certificate issuers | SSL certificate issuance restriction |
Common mistakes mixing up record types
Attempting to use a CNAME record where an MX or specific verification record is actually required (since a CNAME's technical constraint against coexisting with other record types at the same name can create conflicts if not understood). Confusing an A record change (affecting only the website) with the separate MX record needed for email, covered as a common real-world confusion in our dedicated MX diagnosis guide. And adding a TXT record with a typo or incorrect formatting, since TXT records' free-form text nature means there is no automatic structural validation catching a simple transcription error the way a more rigidly formatted record type might.
FAQs
Can I have multiple A records for the same domain?
Yes, multiple A records for the same domain name provide DNS-level load balancing or redundancy, with requesting systems typically choosing among the listed IP addresses, though this is a more advanced configuration than the typical single-server setup most small businesses use.
Does changing my nameservers affect all these record types at once?
Yes, since nameservers determine which system is authoritative for answering all DNS queries about your domain, changing nameservers means all record types (A, MX, TXT, and others) need to be reconfigured at the new nameserver location, covered in more detail in our dedicated DNS management guide.
Why can't I add a CNAME record at my domain's root (apex)?
This is a specific technical constraint of the CNAME record type and the DNS root zone's own requirements (which need certain other record types, like NS and SOA, present at the apex that cannot coexist with a CNAME there); most DNS providers offer an alternative (sometimes called ALIAS or ANAME) providing similar functionality specifically for the root domain where a literal CNAME cannot be used.
How many TXT records can a domain have?
There is generally no strict limit on the number of TXT records a domain can have, though very large numbers of records or very long individual TXT record values can occasionally interact with certain size limits in DNS query responses, a more advanced, less commonly encountered consideration for most typical small business domain configurations.
Does the order of MX records matter?
Yes, the priority value associated with each MX record determines the preferred order mail servers should be attempted, with lower priority numbers indicating higher preference, meaning a domain with multiple MX records uses this priority value to determine primary versus backup mail server preference.
Can I check what DNS records are currently configured for my domain?
Yes, a DNS lookup tool checked against your specific domain shows the currently published records of a given type, a direct way to confirm your actual current configuration rather than relying purely on what you believe was configured previously.
Does every domain need all of these record types?
No, only the record types relevant to what the domain actually needs to do; a domain used purely for a website with no associated email might have only an A record (or CNAME, depending on setup) and no MX record at all, while a domain with no actual website but used purely for email might have only MX and supporting TXT records without a meaningful A record.
Conclusion
Each DNS record type answers a genuinely distinct, specific question, an A record for direct server IP mapping, a CNAME for domain-to-domain aliasing, an MX record for mail routing, and a TXT record for the flexible verification and policy purposes spanning SPF, DKIM, DMARC, and site ownership confirmation. Understanding which type genuinely answers which question, rather than treating DNS configuration as an undifferentiated single task, prevents the mixing-up mistakes behind a meaningful share of the confusing, hard-to-diagnose DNS problems covered across our other guides.
HostCloud's free DNS record checker lets you directly inspect your domain's current configuration across all these record types, confirming your actual setup rather than relying on assumption. Try it at https://hostcloud.in/tools.
