Skip to main content

DNS records explained

DNS records are short instructions stored for your domain. Each one answers a single question, such as "where is the website?" or "which servers accept email?". This guide explains the record types you are most likely to edit and the rules that keep them working.

How to read a DNS record​

Every record has four parts:

PartWhat it meansExample
Name (or host)Which name the record is for. @ usually means the domain itself.www
TypeWhat kind of answer it gives.A
Value (or target, data)The answer itself.203.0.113.10
TTLHow many seconds other networks may keep a copy.3600

DNS editors show these in a form, but the same record is often written on one line, in the style of a zone file:

www.example.com. 3600 IN A 203.0.113.10

Read it as: "for www.example.com, keep this for an hour; its IPv4 address is 203.0.113.10." IN stands for internet and can be ignored. The dot at the end of a full name is how zone files mark it as complete; most DNS editors add it for you.

Name or full name?

Many DNS editors ask only for the part in front of your domain. Typing www creates www.example.com. If you type www.example.com in that kind of field, some editors create www.example.com.example.com. Check the editor's hint, or look at the record after saving.

Record types​

A and AAAA: the website's address​

An A record points a name to an IPv4 address. An AAAA record does the same for an IPv6 address. Your hosting provider tells you which addresses to use.

example.com. 3600 IN A 203.0.113.10
example.com. 3600 IN AAAA 2001:db8::10

Only add an AAAA record if your host gives you an IPv6 address. A wrong AAAA record can make the site fail for visitors whose networks prefer IPv6.

CNAME: an alias for another name​

A CNAME record says "this name is another name for that one". It is often used to point www at the domain itself or at a name a service gives you.

www.example.com. 3600 IN CNAME example.com.

Two rules apply to CNAME records:

  • A name that has a CNAME cannot have any other record. So you cannot put a CNAME on the apex domain (example.com itself), because the apex always needs other records, such as NS.
  • The target must be a name, not an IP address.

Some DNS providers offer a substitute for the apex, often called ALIAS, ANAME or CNAME flattening. It is not a standard record type, so it only works where the provider supports it.

MX: where email is delivered​

MX records name the servers that receive email for your domain. Each has a priority: lower numbers are tried first.

example.com. 3600 IN MX 10 mx1.example.net.
example.com. 3600 IN MX 20 mx2.example.net.

An MX record must point to a name that has its own A or AAAA record. It must not point to an IP address or to a CNAME. Use exactly the values your email provider gives you.

TXT: text that other services check​

TXT records hold text. They are used to prove you own a domain and to protect your email with SPF, DKIM and DMARC.

example.com. 3600 IN TXT "v=spf1 include:_spf.example.net ~all"
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

A domain can have several TXT records, but only one of them may be an SPF record (one starting v=spf1). To allow more senders, add them to that single record. See SPF, DKIM and DMARC.

NS: who answers for the domain​

NS records list the nameservers for a domain. The ones that matter are set at your registrar, which publishes them to the registry. You change them when you move your whole DNS to another provider, as described in Connect a domain to a website.

NS records inside a zone can also hand a subdomain to different nameservers, which is called delegation.

CAA: who may issue certificates​

A CAA record lists the certificate authorities allowed to issue SSL certificates for your domain. If you have no CAA record, any publicly trusted authority may issue one. If you add one, include every authority you use, or certificate renewals can fail.

example.com. 3600 IN CAA 0 issue "ca.example.net"

SRV: services on specific ports​

SRV records tell apps which server and port to use for a service, such as some calling, chat or email autoconfiguration systems. Add them only when a service asks for them, and copy every field exactly.

TTL: how long answers are kept​

The TTL tells other networks how long they may reuse an answer before asking again. A TTL of 3600 (one hour) suits most records. Before a planned change, lower the TTL so the change reaches everyone faster, as explained in Why DNS changes take time.

Avoid these common mistakes​

  • Two records that disagree. Two A records for the same name send some visitors to each address. Remove the old one when you move.
  • A CNAME next to other records. Delete the other records for that name first, or use an A record instead.
  • Extra quotes or spaces in TXT values. Paste the value exactly as given. Many editors add the surrounding quotes for you.
  • Editing records at the wrong provider. Only the provider that runs your current nameservers can change your live DNS. Check your nameservers first.

Did this article help you?