- What is a DNS record?The domain name system is a distributed phone book.
- Which DNS record types do you need to know?For a normal website you mostly need A (and AAAA) records.
- What is the difference between an A record and a CNAME?An A record maps a name straight to an IP address.
What is a DNS record?
The domain name system is a distributed phone book. For each domain there is a set of records held by its authoritative nameservers. When a browser, mail server or other program needs something about your domain, it asks DNS and gets the matching records back.
Each record has a name, a type, a value and a TTL. The name says which hostname it applies to (the bare domain, www, mail and so on). The type says what kind of answer it is. The value is the answer. The TTL says how many seconds others may cache the answer.
Which DNS record types do you need to know?
For a normal website you mostly need A (and AAAA) records. Email adds MX and several TXT records. A CNAME is common for www and for third-party services, and CAA is an optional safety record.
| Type | What it does | Example value |
|---|---|---|
| A | Points a name to an IPv4 address | 203.0.113.10 |
| AAAA | Points a name to an IPv6 address | 2001:db8::10 |
| CNAME | Makes a name an alias of another name | shops.example.net |
| MX | Names the mail servers for the domain, with a priority | 10 mail.example.com |
| TXT | Holds text: SPF, DKIM, DMARC, domain verification | v=spf1 include:_spf.example.net ~all |
| NS | Lists the nameservers that answer for the domain | ns1.example.net |
| CAA | Says which certificate authorities may issue certificates | 0 issue “letsencrypt.org” |
What is the difference between an A record and a CNAME?
An A record maps a name straight to an IP address. A CNAME maps a name to another name, and DNS then looks up that name. That is handy when a service gives you a hostname instead of an address, because the provider can change the IP address without you editing anything.
There is one important rule: a name that has a CNAME cannot also hold other records. That is why the bare domain (example.com), which needs NS and often MX and TXT records, normally uses an A record rather than a CNAME. Some DNS providers offer a flattened alias to work around it, but it is a provider feature, not a standard record type.
How do MX, SPF, DKIM and DMARC fit together?
MX records decide where incoming mail is delivered. The other three are TXT records that help receiving servers trust the mail you send. SPF lists the servers allowed to send for your domain. DKIM adds a cryptographic signature that proves a message was not altered. DMARC tells receivers what to do when SPF or DKIM checks fail and where to send reports.
If you move email to a new provider, update all four. A common cause of mail landing in spam after a migration is an old SPF record that does not include the new sender.
What is TTL and why do DNS changes take time?
TTL, or time to live, is the number of seconds a resolver may keep an answer before asking again. If your A record has a TTL of 3600, a resolver that cached it a minute ago will keep serving the old address for up to another 59 minutes. This is the real meaning of “propagation”: there is no single broadcast, just caches expiring at different times.
Planning a move? Lower the TTL to 300 seconds a day or two before the change, make the change, then raise it again afterwards. Changing the records first and the TTL second does not help, because resolvers already hold the old, long-lived answer.
How do you change DNS records safely?
Our DNS lookup tool shows the records resolvers return for any domain. Compare its output with your list after every change.
- Export or copy what exists
Write down every record before you touch anything, including MX and TXT.
- Change one thing at a time
Make a single change, then test it before the next.
- Check from outside
Use a lookup tool to see what other resolvers return, not only your own computer.
- Keep the old setup running
Leave the old server up until the new records have been live for a few days.
What are the most common DNS mistakes?
- Deleting MX records while changing nameservers and losing email.
- Adding a CNAME on the bare domain where other records already exist.
- Forgetting the www record, so only one of example.com and www.example.com works.
- Leaving a very long TTL in place before a migration.
- Typing the value with a trailing space or the wrong quotation marks in a TXT record.
How does a DNS lookup actually happen?
When a browser needs example.com, it first asks a recursive resolver, usually run by your internet provider or a public service. If the resolver has the answer cached and the TTL has not expired, it replies at once. If not, it starts at the root, asks the .com servers which nameservers are responsible for example.com, then asks those nameservers for the record. The answer is cached on the way back.
This is why changes seem inconsistent: different resolvers cached the answer at different times. It also explains why DNS is fast. Most lookups are answered from a nearby cache, and only the first request in a while travels the full path.
What records does a typical website need?
When you are not sure what your domain already uses, run a lookup first. Our DNS lookup tool lists the records resolvers return, and our who hosts this website tool can show which provider is behind an address.
| Goal | Records you set |
|---|---|
| A site on one server | A for the bare domain, A or CNAME for www |
| A site with IPv6 | Add AAAA records that match the A records |
| Email at the domain | MX records, plus SPF, DKIM and DMARC as TXT records |
| Proof of ownership for a tool or search console | A TXT record, or a CNAME, given by the service |
| A shop or app on a subdomain | A or CNAME for the subdomain, such as shop.example.com |
| Restricting certificate issuance | A CAA record naming the allowed authority |
What do DNS records have to do with hosting?
Your host gives you either nameservers or an IP address, and DNS records are how your domain uses them. If you are connecting a domain for the first time, follow how to point a domain to your hosting. If you change providers, plan the switch with the website migration checklist and read nameservers explained first, because many outages during migrations are DNS mistakes, not hosting problems.
How can you troubleshoot DNS problems?
- Query the authoritative nameservers directly, not only a public resolver, to see the true value.
- Compare answers from two or three resolvers. Different answers mean a cache has not expired.
- Check the exact name: example.com and www.example.com are different names with separate records.
- Look for a CNAME on a name that also has other records, which is not allowed.
- Check whether DNSSEC is enabled. A broken DNSSEC chain makes validating resolvers refuse to answer.
- After a fix, wait for the TTL that was in place before the fix, not the new one.