DNS Record Types Explained: A, AAAA, CNAME, MX, TXT and More

RSS

DNS record types tell resolvers exactly what kind of information a name holds: A and AAAA records point to IP addresses, CNAME creates aliases, MX routes email, TXT carries verification and security policies, and NS and SOA describe the zone itself. Knowing which record does what is really the whole key to configuring a domain correctly.

Every domain's DNS lives in what's called a zone — a set of records hosted on its authoritative name servers. Each record carries a name, a TTL (how long it's allowed to be cached), a class (almost always IN, for internet) and a type, followed by type-specific data. New to how lookups actually work? Start with What is DNS and how does it work?, then come back here.

One shorthand you'll see throughout the examples below: @ stands for the domain itself (the "apex" or "root" of the zone) — here, example.com.

Summary of common record types

TypePurposeExample value
AMaps a name to an IPv4 address192.0.2.10
AAAAMaps a name to an IPv6 address2001:db8::10
CNAMEMakes a name an alias of another nameapp.example.net.
MXMail servers for the domain, with priority10 mail.example.com.
NSAuthoritative name servers for the zonens1.example.net.
TXTFree text: SPF, DMARC, DKIM, site verification"v=spf1 mx -all"
SOAZone metadata: primary server, serial, timersSee below
CAAWhich certificate authorities may issue certificates0 issue "ca.example.net"
SRVHost and port for a specific service10 5 5060 sip.example.com.
PTRMaps an IP address back to a namemail.example.com.
HTTPS / SVCBConnection hints such as HTTP/3 support1 . alpn="h2,h3"

A and AAAA records

The A record is as fundamental as DNS gets: it maps a name to a 32-bit IPv4 address, full stop. The AAAA record ("quad-A") does the identical job for 128-bit IPv6 addresses. A name can hold several of each, and resolvers hand back all of them at once — clients just pick one, which gives you simple load distribution and redundancy for free.

@      3600  IN  A     192.0.2.10
@      3600  IN  AAAA  2001:db8::10
www    3600  IN  A     192.0.2.10
www    3600  IN  AAAA  2001:db8::10

Got IPv6 connectivity on your server? Publish an AAAA record right alongside the A record, so IPv6-capable visitors can reach you natively instead of falling back.

CNAME records

A CNAME (canonical name) is basically a signpost: "this name is an alias, go look up that other name instead." It's the go-to for pointing subdomains at hosted services — a CDN, a website builder — whose IP addresses might change without warning.

shop   3600  IN  CNAME  stores.example.net.

CNAMEs come with some strict rules, though. A name that has a CNAME can't have any other record of any type sitting alongside it. And since the zone apex always needs SOA and NS records present, you can't place a CNAME at the apex (example.com itself) — only on subdomains like www. One more gotcha: MX and NS records should point to names that have A or AAAA records, never to CNAMEs.

ALIAS, ANAME and CNAME flattening

To get around that apex restriction, plenty of DNS providers offer a proprietary record — called ALIAS, ANAME, or "CNAME flattening" depending who you ask. You configure it just like a CNAME, except the provider's own servers resolve the target behind the scenes and answer with ordinary A and AAAA records. To the outside world it just looks like a normal A record. Keep in mind this isn't a standard record type, so it only works if your particular DNS host happens to support it.

MX records

MX (mail exchanger) records tell other mail servers exactly where to deliver email for your domain. Each one carries a preference number — lower values get tried first, and equal values share the load between them.

@   3600  IN  MX  10 mail1.example.com.
@   3600  IN  MX  20 mail2.example.com.

Here, senders try mail1 first and only fall back to mail2 if it's unreachable. Want to check any domain's mail routing yourself? Our MX lookup tool handles that.

NS records

NS records list the authoritative name servers for a zone. They show up in two places at once: inside your own zone, and as a delegation in the parent (TLD) zone, which you set through your registrar. Those two sets need to match. And use at least two name servers, ideally on separate networks, so your domain doesn't go dark just because one of them does.

@   86400  IN  NS  ns1.example.net.
@   86400  IN  NS  ns2.example.net.

NS records can also delegate a subdomain off to different servers entirely — handing dev.example.com to a separate DNS provider, say.

TXT records

TXT records just hold arbitrary text, but over time they've quietly become the place where machine-readable policies and ownership proofs live:

  • SPF lists the servers allowed to send mail for the domain.
  • DKIM public keys live at selector._domainkey.example.com.
  • DMARC policies live at _dmarc.example.com.
  • Domain verification tokens prove control to services like search consoles and email providers.
@        3600  IN  TXT  "v=spf1 include:_spf.example.net -all"
_dmarc   3600  IN  TXT  "v=DMARC1; p=quarantine; rua=mailto:[email protected]"

A single TXT string tops out at 255 characters, so longer values like DKIM keys get split across several quoted strings that are joined back together. Curious how these all work together? See SPF, DKIM and DMARC explained.

SOA record

Every zone has exactly one SOA (start of authority) record, sitting at its apex. Unlike most of the records here, it describes the zone itself rather than any particular service:

@  IN  SOA  ns1.example.net. hostmaster.example.com. (
        2026101301 ; serial
        7200       ; refresh
        3600       ; retry
        1209600    ; expire
        3600 )     ; minimum (negative caching TTL)
  • MNAME (ns1.example.net.): the primary name server.
  • RNAME (hostmaster.example.com.): the administrator's email address — the first dot stands in for @.
  • Serial: a version number that has to go up with every change, so secondary servers know there's something new to grab. A date-based format like YYYYMMDDnn is the common convention.
  • Refresh and retry: how often secondaries check in for updates, and how quickly they retry after a failed attempt.
  • Expire: how long a secondary keeps serving the zone if it loses contact with the primary entirely.
  • Minimum: these days, used as the TTL for caching negative ("does not exist") answers.

CAA records

CAA (certification authority authorization) records spell out which certificate authorities are allowed to issue TLS certificates for your domain. Publicly trusted CAs are required to check these before issuing anything, so a CAA record caps the damage if someone ever tries getting a certificate for your domain from a CA you didn't authorise.

@  3600  IN  CAA  0 issue "ca.example.net"
@  3600  IN  CAA  0 issuewild ";"
@  3600  IN  CAA  0 iodef "mailto:[email protected]"

This setup allows only the CA identified as ca.example.net to issue regular certificates (each CA documents its own exact value to use), forbids wildcard certificates from any CA whatsoever, and asks CAs to report violations when they see them. No CAA record at all means any CA can issue.

SRV records

SRV records advertise both the host and port for a particular service — something an A record simply can't do. The name follows the pattern _service._protocol.domain, and the data itself packs in priority, weight, port and target:

_sip._tcp   3600  IN  SRV  10 60 5060 sip1.example.com.
_sip._tcp   3600  IN  SRV  10 40 5060 sip2.example.com.

Both targets here share priority 10, so clients end up splitting traffic roughly 60/40 by weight. You'll find SRV behind SIP, XMPP, LDAP, Microsoft Active Directory, and even some games, Minecraft Java Edition among them.

PTR records

PTR records are what power reverse DNS — they map an IP address back to a hostname, the mirror image of an A record. They live in special zones (in-addr.arpa for IPv4, ip6.arpa for IPv6) controlled by whoever owns the IP block, which is usually your hosting provider or ISP, not your domain's own DNS host.

10.2.0.192.in-addr.arpa.  3600  IN  PTR  mail.example.com.

Mail servers lean on these heavily when deciding what to trust. Read What is reverse DNS? for the full details.

HTTPS, SVCB and DNSSEC records

SVCB, and its web-specific sibling HTTPS (standardized in RFC 9460), let a domain advertise connection details up front — support for HTTP/3, alternative endpoints — saving everyone a round trip. Unlike CNAME, notably, an HTTPS record can sit right at the zone apex.

DNSSEC brings its own set of record types along too. DNSKEY holds the zone's public signing keys, RRSIG holds signatures over each record set, and a DS record — published in the parent zone through your registrar — links your keys into the chain of trust that starts all the way back at the root.

Tip: Want to see which of these records a domain publishes right now? Run a query with our DNS lookup tool, which supports A, AAAA, CNAME, MX, NS, TXT, SOA, CAA and SRV.

Frequently asked questions

Can a domain have multiple A records?

Yes. Resolvers hand back every A record for the name, and clients typically try them one after another. It's a basic form of load balancing and redundancy, though it won't detect a failed server on its own.

Should I use a CNAME or an A record for www?

Use a CNAME when www needs to follow a hosted service whose addresses you don't control, like a CDN. Use A and AAAA records instead if you run the server yourself and already know its fixed addresses.

Can I have more than one SPF TXT record?

No, and this trips people up. A domain can publish only one TXT record starting with v=spf1. Two or more causes SPF checks to return a permanent error. Merge all your senders into a single record instead.

How long do DNS record changes take?

The change goes live on your name servers immediately, but resolvers out there may keep serving the old value until its TTL runs out. Lowering the TTL a day ahead of a planned change keeps that switchover mercifully short.

Попробуйте сами

Примените это руководство на практике с помощью наших бесплатных инструментов.

Комментарии

Поделитесь советом, задайте вопрос или расскажите, как вам помог инструмент.

Читать далее

Скопировано в буфер обмена