# What are DNS records? A, CNAME, MX and TXT explained

> The DNS record types you will meet when you set up a site or email, what each does, how TTL and propagation work and a safe way to change records.

Source: https://comparehostingonline.com/guides/what-are-dns-records/

## Short answer

DNS records are instructions stored for your domain. An A record points the name to a server's IPv4 address, a CNAME makes one name an alias of another, MX records say where email goes and TXT records hold text such as SPF and verification codes. Each record has a TTL that controls how long it is cached.

Last verified Nov 28, 2026 · [How we test](https://comparehostingonline.com/methodology/)

At a glance

-   **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.

1.  1
    
    **Export or copy what exists**
    
    Write down every record before you touch anything, including MX and TXT.
    
2.  2
    
    **Change one thing at a time**
    
    Make a single change, then test it before the next.
    
3.  3
    
    **Check from outside**
    
    Use a lookup tool to see what other resolvers return, not only your own computer.
    
4.  4
    
    **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](http://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](https://comparehostingonline.com/tools/dns-lookup/) lists the records resolvers return, and our [who hosts this website tool](https://comparehostingonline.com/tools/who-hosts-this/) 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](https://comparehostingonline.com/guides/point-domain-to-hosting/). If you change providers, plan the switch with the [website migration checklist](https://comparehostingonline.com/guides/website-migration-checklist/) and read [nameservers explained](https://comparehostingonline.com/guides/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](http://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.

## Sources and further reading

-   [MDN: DNS glossary entry](https://developer.mozilla.org/en-US/docs/Glossary/DNS)
-   [RFC 1035: Domain names, implementation and specification](https://www.rfc-editor.org/rfc/rfc1035)
-   [RFC 7208: Sender Policy Framework (SPF)](https://www.rfc-editor.org/rfc/rfc7208)
-   [RFC 6376: DKIM signatures](https://www.rfc-editor.org/rfc/rfc6376)
-   [RFC 7489: DMARC](https://www.rfc-editor.org/rfc/rfc7489)
-   [Cloudflare DNS documentation](https://developers.cloudflare.com/dns/)

## Common questions

What is the difference between an A record and a CNAME record?

An A record points a name to an IPv4 address. A CNAME points a name to another name, and DNS then resolves that name. A name with a CNAME cannot hold other records, so the bare domain normally uses an A record.

What does TTL mean in DNS?

TTL, time to live, is the number of seconds a resolver may cache an answer. A TTL of 3600 means up to an hour. Lower it a day before a planned change so old answers expire quickly and the switch reaches visitors sooner.

Why is my DNS change not showing yet?

Almost always caching. Resolvers keep the old answer until its TTL ends. Check the record at the authoritative nameserver, compare with a public resolver and wait for the old TTL. Also confirm you edited the right name, such as www or the bare domain.

What are SPF, DKIM and DMARC records?

They are TXT records that help receivers trust your mail. SPF lists servers allowed to send for your domain, DKIM adds a signature to messages and DMARC tells receivers what to do with mail that fails and where to send reports.

How do I look up the DNS records of a domain?

Use a DNS lookup tool, such as ours, or a command-line tool like dig. Look up the specific type you need, for example A, MX or TXT, and query more than one resolver if you suspect caching is hiding a recent change.

## Related

[What is DNS?](https://comparehostingonline.com/guides/what-is-dns/) [DNS lookup tool](https://comparehostingonline.com/tools/dns-lookup/) [Nameservers explained](https://comparehostingonline.com/guides/nameservers-explained/) [Point a domain to hosting](https://comparehostingonline.com/guides/point-domain-to-hosting/)

## More guides

[What is an SSL certificate? How HTTPS works and what to check](https://comparehostingonline.com/guides/what-is-an-ssl-certificate/) [How to choose web hosting: a step-by-step guide](https://comparehostingonline.com/guides/how-to-choose-web-hosting/) [How much does web hosting cost? Prices by type and what changes them](https://comparehostingonline.com/guides/how-much-does-web-hosting-cost/) [CDN service explained: what it does, free options and how to choose one](https://comparehostingonline.com/guides/what-is-a-cdn/)

MH

**[Muhammad Hamza](https://comparehostingonline.com/team/muhammad-hamza/)** Founder & Editor

Writes and signs off every comparison, and runs the compliance reviews. Has worked on SOC 2 and HIPAA compliance programs for companies.

Our [editorial policy](https://comparehostingonline.com/editorial-policy/) and [testing method](https://comparehostingonline.com/methodology/) are public.
