Skip to content

DNS Records Made Simple: A, CNAME, MX and TXT

A simple yet in-depth guide to the most important DNS records: what each record does (A, AAAA, CNAME, MX, TXT, NS, CAA), when to use it, practical examples, reference tables, and how TTL, propagation and troubleshooting work.

Domainsهند الدوسري29 min read
Illustration of an index card drawer with record cards marked by an arrow, a link, an envelope and text lines, representing DNS record types
On this page

What is DNS in the first place?

DNS (the Domain Name System) translates the names people remember (such as example.com) into the IP addresses devices understand (such as 93.184.216.34). Without it, we would memorize numbers instead of names, and getting around millions of sites would be impossible. You can think of DNS as the internet's giant "phone book": you know the person's name, and the book gives you their number. The difference is that this book is distributed across millions of servers around the world, is updated constantly, and works in fractions of a second.

The key idea to grasp before anything else: your domain itself does not "contain" your site. The domain is just a name, and the site lives on a server with an IP address. DNS records are the bridge that links the name to the address and to all the services associated with it (email, certificates, ownership verification). Once you understand this layer, you stop "guessing" in your domain management panel and start configuring each record with confidence.

Every domain you own has a set of records stored in a DNS zone, managed through your provider's nameservers. These records are what you edit in the control panel to tell the internet: "This domain points here, its email goes there, and its certificates are issued by this authority only." When you visit a site, your browser asks a chain of DNS servers until it reaches the nameservers responsible for your domain, which return the requested record.

How is a domain name resolved to an IP address?BrowserRequests the siteResolverResolverRootRootTLD server.comAuthoritative serverAuthoritativeThe IP address comes back (e.g. 93.184.216.34) and the site opens
The query's journey: browser > resolver > root > TLD server (such as com.) > authoritative server, then the IP address comes back.

How is a domain name resolved, step by step?

When you type example.com in the browser and press Enter, a chain of queries runs in fractions of a second. Understanding this chain explains almost every question you will later have about "why my change isn't showing" and "why the site works for me but not for my friend." Here is exactly what happens:

  1. Local check (browser and system cache): the first thing your device does is look in its cache. Has it resolved this name recently? If a valid copy exists (its TTL has not expired), it is used immediately without any network connection. The device also checks the local hosts file, which bypasses DNS entirely.
  2. Recursive resolver: if the copy is not available locally, your device sends the query to a recursive resolver, usually belonging to your internet provider, or a public resolver such as Cloudflare's 1.1.1.1 or Google's 8.8.8.8. This resolver is the "agent" that will do all the hard work on your behalf. It also has its own cache, so if another user of the same resolver requested example.com a few minutes ago, the resolver answers you straight from its cache.
  3. Root server: if the recursive resolver does not find the answer in its cache, it starts the journey "from the top." It asks one of the thirteen logical root servers (replicated at hundreds of locations around the world): "Where do I find whoever is responsible for domains ending in .com?" The root server does not know the address of example.com, but it knows who manages the .com extension, so it refers you to the TLD servers.
  4. Top-level domain (TLD) server: this server is responsible for a particular extension such as .com, .net or .sa. The resolver asks it: "Who manages example.com specifically?" The TLD server responds with the addresses of the authoritative nameservers registered for this domain, the servers you entered in your domain registrar's panel.
  5. Authoritative nameserver: this is the final stop and the source of truth. This server holds your domain's actual DNS zone, containing all your records (A, MX, TXT...). The resolver asks it for the requested record (an A record, for example), and it responds with the address: 93.184.216.34.
  6. Caching, then the answer: the recursive resolver receives the address, caches it for a period equal to the TTL, then returns it to your device. Your device in turn caches it locally and opens a connection to the server at that address. The site appears.
StageWho it asksWhat it getsDoes it cache the result?
Local cacheThe device/browser cacheAn instant answer if one existsYes
Recursive resolverDrives the whole journeyThe final answer for the clientYes (per TTL)
Root serverRecursive resolverA referral to the TLD serverNo (a fixed reference)
TLD serverRecursive resolverThe authoritative nameserversYes (TTL for the referral)
Authoritative serverRecursive resolverThe actual requested recordYes (TTL for the record)

The crucial point: every step involves caching, and that is exactly why your changes do not show up immediately. You changed the record on the authoritative server, but millions of resolvers around the world still hold the old copy until the TTL expires. This is what we call "DNS propagation," and we will go into it in detail later.

The most important DNS records in one table

Before going deeper, here is a quick map of the most commonly used records. Each row answers a practical question: what this record links, what an example looks like, and why you use it.

RecordLinksExampleUse
AName > IPv4@ → 93.184.216.34Pointing the domain to your server
AAAAName > IPv6@ → 2606:2800:220:1::Same as A, but for IPv6 addresses
CNAMEName > another namewww → example.comAlias/subdomain
MXEmail > mail server@ → mail.example.com (10)Receiving email
TXTFree textv=spf1 include:... ~allVerification and email security
NSDomain > nameservers@ → ns1.host.comWho manages the domain's DNS
CAADomain > certificate issuer0 issue "letsencrypt.org"Who is allowed to issue SSL
SRVService > host + port_sip._tcp → 10 5 5060 sip.example.comSpecifying the server for a particular service
PTRIP > name34.216.184.93.in-addr.arpa → mail.example.comReverse DNS (important for email)
SOAStart of the zonens1.host.com admin.example.com ...Zone administration data
ALIAS/ANAMERoot > name@ → app.netlify.appA flattened CNAME at the root

Each record explained in detail

A and AAAA records

The A record is by far the most widely used: it maps your domain (or a subdomain) to your server's IPv4 address. The value is always a numeric address made of four fields. Practical examples:

Code
@      A   93.184.216.34      ; The root example.com points to your server
blog   A   185.199.108.153    ; blog.example.com points to another server

You can also create several A records for the same name pointing to different addresses, so DNS spreads requests between them (round-robin) for basic load distribution. The AAAA record does the same thing but for the newer, longer IPv6 addresses, and it coexists with A without any problem: the client prefers IPv6 if available and otherwise falls back to IPv4:

Code
@      AAAA   2606:2800:220:1::         ; The IPv6 version for the root
www    AAAA   2606:2800:220:1:248:1893:25c8:1946

The practical rule: use A for the root and for servers whose fixed numeric address you know. And if your server supports IPv6 (most modern hosting does), add the matching AAAA so visitors on modern networks reach you by the fastest route.

The CNAME record

It makes one name an alias for another, so the first is resolved by referring to the second. This is very useful when you don't know the destination's fixed IP address, or when its addresses change constantly (as with cloud hosting services and content delivery networks). Examples:

Code
www    CNAME   example.com.            ; www follows the root
shop   CNAME   mystore.myshopify.com.  ; The store is hosted by a third party
cdn    CNAME   d111.cloudfront.net.    ; A subdomain that follows a CDN

Two important rules: you cannot put a CNAME on the root domain (@), because it conflicts with mandatory records at the root such as SOA and NS, and a CNAME cannot be mixed with any other record for the same name. To get around the root restriction, providers developed the ALIAS/ANAME record, which we will explain shortly.

The MX record

It routes your domain's email to the correct mail server and carries a priority number, where the lower number has the higher priority. You usually use two or more records: the primary with a low priority number, and a backup with a higher number that is used if the first one fails:

Code
@   MX   10   mx1.example-mail.com.   ; Primary
@   MX   20   mx2.example-mail.com.   ; Backup

A common point of error: the MX value must be a name (hostname), not an IP address, and that name must have a valid A/AAAA record that resolves it to an address. Without a correct MX, your domain's email will not arrive at all.

The TXT record (the key to email security)

It stores free text that services use for verification. Its best-known use by far is email authentication (covered in its own section later), as well as verifying domain ownership with services such as Google Search Console and marketing platforms:

Code
@                    TXT   "google-site-verification=abcdef123456"
@                    TXT   "v=spf1 include:_spf.google.com ~all"
selector1._domainkey TXT   "v=DKIM1; k=rsa; p=MIGfMA0GCSq..."
Use (inside TXT)What it does
SPFSpecifies the servers allowed to send in your domain's name
DKIMA digital signature proving the message was not altered on the way
DMARCThe policy when SPF/DKIM fails + where reports are sent
Ownership verificationProves to an external service that you own the domain

NS and CAA records

NS specifies the authoritative nameservers responsible for your domain. These records are usually set at the domain registrar (the level above), and they are updated when you change DNS providers or move the domain to a new provider:

Code
@   NS   ns1.example.net.
@   NS   ns2.example.net.

CAA specifies the certificate authorities allowed to issue SSL certificates for your domain, adding a layer of security that prevents an unauthorized party from issuing a certificate in your name:

Code
@   CAA   0 issue "letsencrypt.org"          ; Allows Let's Encrypt only
@   CAA   0 issuewild "letsencrypt.org"      ; Allows wildcard certificates from it
@   CAA   0 iodef "mailto:security@example.com"  ; Notify me of a violating request

See the certificate details in installing an SSL certificate and enabling HTTPS.

Lesser-known but important records (SRV/PTR/SOA/CAA)

Beyond the core records, there are "second-tier" records you may not touch every day, but that are decisive in specific situations, especially where email, voice and communication services, or the integrity of the zone itself are concerned. Ignoring them is a common cause of obscure problems that are hard to diagnose.

The SRV record (locating a service on a port)

It tells the client where a particular service runs and on which port, instead of assuming the default port. It is widely used in protocols such as SIP (internet telephony), XMPP (chat), Microsoft Teams/Skype for Business, and Minecraft games. Its format: _service._protocol SRV priority weight port host:

Code
_sip._tcp.example.com.        SRV   10 60 5060 sip1.example.com.
_minecraft._tcp.example.com.  SRV   0 5 25565 mc.example.com.

"Priority" works as in MX (lowest first), and "weight" distributes the load among records with the same priority.

The PTR record (reverse DNS, important for email)

Everything so far has been "forward": from a name to an address. The PTR record works the exact opposite way: from an IP address to a name. It is used in the reverse zone (in-addr.arpa for IPv4 and ip6.arpa for IPv6), and its greatest importance is in email delivery: when your server sends email, the receiving server checks the address it connected from and verifies whether it reverse-resolves to a sensible name that matches the sender's identity (forward-confirmed reverse DNS). If there is no PTR or it does not match, your messages are classified as spam or rejected:

Code
34.216.184.93.in-addr.arpa.   PTR   mail.example.com.
1.0.0...e.ip6.arpa.           PTR   mail.example.com.

An important practical note: you usually do not set the PTR record in your domain's zone; it is set by the owner of the address, that is, the hosting company or server provider, because it lives in the reverse zone belonging to the address block. So if you need a correct PTR for a mail server, ask your hosting provider for it.

The SOA record (start of authority over the zone)

Every DNS zone must contain exactly one SOA (Start of Authority) record at the root, which is the zone's "ID card." It carries administrative data: the primary nameserver, the administrator's email, a serial number that increases with every change so secondary servers know they must update, and timing values for refresh, retry and expiry:

Code
example.com.   SOA   ns1.example.net. admin.example.com. (
                      2026061101   ; Serial (the date + the day's change number)
                      7200         ; Refresh
                      3600         ; Retry
                      1209600      ; Expire
                      300 )        ; Minimum / negative TTL

You rarely edit the SOA by hand, but understanding it is useful when diagnosing synchronization problems between nameservers, or when you notice that the serial number has not changed despite your edit (which means the change was not actually published).

The ALIAS/ANAME record (a flattened CNAME at the root)

We mentioned that a CNAME is not allowed at the root. But what if your hosting (such as Netlify, Vercel or a CDN service) gives you a name rather than an address, and you want example.com itself to point to it? This is where the ALIAS record comes in (some providers call it ANAME or CNAME flattening). On the surface it behaves like a CNAME, but the provider "flattens" it internally: it resolves the target name to an IP address and answers with an ordinary A record, so it does not break the rules for the root:

Code
@      ALIAS   my-site.netlify.app.     ; The root follows third-party hosting
@      ANAME   d111abc.cloudfront.net.  ; The same idea at another provider

It is not a standard record in the original DNS protocol, so its availability depends on your provider. If your provider does not support it, the alternative is an A record with the explicit address, if it is fixed.

Email authentication in detail (SPF/DKIM/DMARC)

The most common reason your email "lands" in the spam folder, or is rejected outright, is weak email authentication. The SPF + DKIM + DMARC trio is what convinces mailbox providers (Gmail, Outlook and others) that your messages are genuine and not spoofing your domain. They are all TXT records (except that DKIM and DMARC are placed on special subdomain names). Let's go through each one with copy-ready examples.

SPF: who is allowed to send in your name?

The SPF (Sender Policy Framework) record lists the servers and services allowed to send email in your domain's name. It is placed as a single TXT record at the root, and it always starts with v=spf1. The golden rule: one SPF record, no more; having two records breaks the mechanism completely:

Code
@   TXT   "v=spf1 include:_spf.google.com include:mailgun.org ip4:93.184.216.34 ~all"

An SPF value consists of "mechanisms" that are read from the left until the first match:

MechanismWhat it meansExample
include:Allow the senders authorized by another domaininclude:_spf.google.com
ip4: / ip6:Allow a specific address/address blockip4:93.184.216.34
aAllow the server in the domain's A recorda
mxAllow the domain's MX serversmx
~allSoftFail: let suspicious mail through but mark it~all
-allHardFail: reject any sender not listed-all
?allNeutral: no verdict (not recommended)?all

The practical difference between ~all and -all matters: use ~all (SoftFail) during setup and testing so you don't lose legitimate email by mistake, then switch to -all (HardFail) once you are sure all your sending sources are listed. Also watch out for the limit of "10 DNS lookups" within SPF; exceeding it invalidates the record.

DKIM: the message's digital signature

The DKIM (DomainKeys Identified Mail) record adds a digital signature to every message sent, proving that it really comes from your domain and was not altered on the way. It works with a key pair: the sending server keeps the private key and signs with it, and you publish the public key in DNS as a TXT record on a subdomain name called a selector. The selector allows more than one key to exist (for example, for periodic key rotation):

Code
selector1._domainkey.example.com.   TXT   "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB...IDAQAB"
google._domainkey.example.com.      TXT   "v=DKIM1; k=rsa; p=MIIBIjANBgkqhki..."

When the message arrives, the recipient reads the selector name from the message header, fetches the public key from DNS and verifies the signature. A matching signature = the message is genuine and intact. You usually get the DKIM value ready-made from your email provider (Google Workspace, Mailgun, etc.) and paste it in as is.

DMARC: policy and reports

The DMARC (Domain-based Message Authentication) record is the leader that ties SPF and DKIM together: it decides what the recipient does when authentication fails, and where it sends reports about what happens in your domain's name. It is placed as a TXT record on the _dmarc subdomain:

Code
_dmarc.example.com.   TXT   "v=DMARC1; p=none; rua=mailto:dmarc@example.com; pct=100; aspf=r; adkim=r"
_dmarc.example.com.   TXT   "v=DMARC1; p=quarantine; rua=mailto:reports@example.com; pct=50"

The most important tag is p= (the policy), and it has three values representing increasing strictness:

Policy (p=)What the recipient does on failureWhen to use it
p=noneNothing; it only monitors and sends reportsThe start: monitor before you tighten
p=quarantinePuts the failing message in spamOnce you are sure legitimate mail passes
p=rejectRejects the failing message outrightThe end goal for full protection

The rua= tag specifies an address to receive daily aggregate reports, which are pure gold for discovering who is spoofing your domain and which of your sending sources you have forgotten. The recommended approach: start with p=none plus rua, read the reports for two weeks, fix any legitimate source that fails, then move gradually to quarantine and then reject. The pct= tag applies the policy to only a percentage of the email, allowing a smoother progression.

CNAME with a CDN

One of the most common uses of CNAME today is connecting your domain to a content delivery network (CDN). A CDN stores copies of your site at dozens of locations around the world, so pages are served from the point closest to the visitor instead of your distant origin server. If you are not familiar with the idea, read What is a content delivery network (CDN)? first.

In practice, the CDN provider gives you a unique name (not an address), because the addresses of its nodes change constantly depending on load and geographic location. So you connect your subdomain to it with a CNAME:

Code
www      CNAME   d111abc.cloudfront.net.   ; A CDN on AWS
assets   CNAME   example.b-cdn.net.        ; A subdomain for static files
cdn      CNAME   example.cdn.cloudflare.net.

If you want to route the root itself (example.com without www) through a CDN, you cannot use a CNAME on the root, as explained; here you use an ALIAS/ANAME record if your provider supports it, or rely on a provider that integrates the CDN with its nameservers and flattens the record automatically. This is one of the reasons to choose a DNS provider that supports CNAME flattening when you plan to use a CDN on the root.

TTL and propagation: why doesn't my change show up immediately?

Every record carries a TTL (time to live) value in seconds, which determines how long resolvers and servers cache a copy of the record before requesting a fresh one from the authoritative server. This is the key to understanding "DNS propagation": when you edit a record, the authoritative server holds the new value immediately, but every resolver in the world will keep serving the old value until the TTL it cached it with runs out.

TTL valueMeaning
300 (5 minutes)Changes that propagate quickly (before a migration)
3600 (an hour)A common balance for ordinary records
86400 (a day)Stability and fewer queries (records that rarely change)

There is no single "correct" TTL value; the optimal value depends on the record type and how often it changes. Here is a practical strategy by type:

Record typeSuggested TTLReason
A/AAAA about to change300 secondsSpeeds up propagation before a migration
Stable A/AAAA3600 secondsA balance between speed and efficiency
MX3600–14400Rarely changes, but keep it flexible
TXT (SPF/DKIM/DMARC)3600You may need to edit it during setup
NS86400Very stable, changes very rarely
CNAME for a CDN3600Usually follows a stable destination

The golden practical tip: before any planned change (moving the site, upgrading the server or switching providers), lower the TTL of the record in question to 300 seconds at least a day before the change, because the reduction itself needs time to propagate under the old value. Then make the actual change and it will propagate within minutes, and afterwards raise the TTL back to a higher value once things are stable, to reduce queries. "DNS propagation" can take anywhere from minutes to hours depending on the TTL and the caches of resolvers around the world; this is normal, not a fault.

DNS checking tools

Don't rely on "Does the site open for me?" to judge whether a change has propagated, because your device may be serving a locally cached copy. Use tools that query the servers directly. Here are the most important ones:

ToolPlatformQueries
digLinux/MacAny record type, in full detail, with TTL
nslookupWindows/allA quick query for a specific record
hostLinux/MacA short, fast query
Online checkerBrowserPropagation across multiple worldwide locations

Practical examples of dig and nslookup commands:

Code
dig example.com A +short             ; IPv4 address only
dig example.com MX                   ; Mail records and their priorities
dig _dmarc.example.com TXT +short    ; The DMARC policy
dig example.com NS                   ; The authoritative nameservers
dig @1.1.1.1 example.com A           ; Query a specific resolver to bypass the local cache
nslookup -type=MX example.com        ; The same idea on Windows

An important point: to check whether a change has propagated globally, use an online checker that queries dozens of locations around the world at the same time. If the new value appears in some locations and the old one in others, propagation is under way and not yet complete; wait for the length of the old TTL. And to bypass your device's local cache, query a public resolver directly by adding @1.1.1.1, as in the example above.

Quick common scenarios

You want toDo this
Point your domain to a new serverUpdate the A record (and AAAA) with the new address
Make www follow the domainA CNAME from www to the root
Point the root to hosting that gives a name, not an IPUse ALIAS/ANAME (a flattened CNAME)
Receive email on your domainAdd an MX record (+ SPF/DKIM/DMARC)
Connect a subdomain to a CDNA CNAME from the subdomain to the CDN's name
Verify domain ownershipAdd the TXT record the service asks for
Restrict who issues your certificateAdd a CAA record
Run a voice/chat serviceAdd an SRV record with the port and host
Improve your email deliveryAsk your server provider for a correct PTR

Subdomains

A subdomain such as blog.example.com or app.example.com is not a separate domain you buy; it is just a DNS record you add under your main domain. This gives you enormous flexibility: you can host the blog on one server, the store on another and the app on a third, all under the same domain at no extra cost. You create a subdomain by adding an A record (if you know the address) or a CNAME (if it follows a name):

Code
blog    A       185.199.108.153          ; The blog on its own server
app     A       93.184.216.34            ; The app on another server
shop    CNAME   mystore.myshopify.com.   ; The store at a third party
docs    CNAME   org.gitbook.io.          ; The documentation on a cloud service

You can also create a "catch-all" (wildcard) subdomain with the * symbol to capture any subdomain that is not explicitly defined, which is useful for multi-tenant SaaS applications where each customer gets their own subdomain:

Code
*       A       93.184.216.34   ; Any undefined subdomain points here

Note that subdomain records follow the same rules as the root: a CNAME cannot be mixed with other records, and the TTL is managed for each record separately. Also note that a subdomain may need its own SSL certificate (or a wildcard certificate covering *.example.com).

Troubleshooting common problems

ProblemLikely causeFix
The site doesn't open after changing the A recordPropagation is not completeWait for the length of the old TTL, and check with dig
The site opens for you but not for othersAn old local cache on your deviceFlush the DNS cache or query @1.1.1.1
Email does not arriveA missing MX or a wrong valueCheck the MX record, its priority, and that it is a name, not an IP
Your email goes to spamMissing or incorrect SPF/DKIM/DMARCConfigure the three TXT records precisely
Your email is rejected outrightA missing or mismatched PTRAsk your server provider for a correct PTR
A CNAME doesn't work on the rootA technical restriction in the protocolUse A or ALIAS/ANAME
The certificate won't issueCAA blocks the issuing authorityAdd the authority to the CAA record or remove the restriction
Your change never propagatesThe SOA serial did not changeMake sure the zone was actually saved and published

Common mistakes

  • Putting a CNAME on the root domain (@) instead of ALIAS/ANAME.
  • Forgetting the MX record, so email never arrives.
  • Setting up more than one SPF record (there must be only one SPF record per domain).
  • Using -all in SPF before confirming that every sending source is listed, so legitimate messages are lost.
  • Leaving DMARC at p=none forever without moving up to quarantine and then reject.
  • Putting an IP address in an MX value or an SPF include instead of a valid hostname.
  • Expecting the change to show up immediately and ignoring the TTL and resolver caches.

Conclusion and next step

Understanding DNS records gives you full control over your domain: where it points, how it receives email, where its files are served from and how it is secured. Start with correct A and AAAA records, add MX along with the SPF, DKIM and DMARC trio for email, use CNAME (or ALIAS at the root) to connect a CDN, and set the TTL wisely before any planned change. And if you are choosing the right hosting setup for your project, compare your options in shared hosting, VPS and managed hosting.

Frequently asked questions

What is the difference between an A record and a CNAME record? An A record maps a name directly to a numeric IP address, while a CNAME maps a name to another name (an alias), which in turn resolves to an IP. Use A for the root and for servers with fixed addresses, and CNAME for subdomains that follow an external name whose address changes, such as CDNs.

Why doesn't a DNS change show up immediately? Because of TTL: resolvers and servers cache a copy of the record until its time runs out. Lower the TTL a day before a planned change to speed up propagation, and expect anywhere from minutes to hours for it to complete worldwide. Check with dig or an online checker instead of relying on your own device.

Which DNS record routes email? The MX record. It specifies the mail server responsible for receiving your domain's messages and carries a priority number (the lower the number, the higher the priority). It is complemented by TXT records for security (SPF, DKIM and DMARC) and by the reverse PTR record on the sender's side to avoid rejection.

Do I need an AAAA record? It is not mandatory, but it is useful if your server supports IPv6, so visitors on modern networks can reach it by the fastest route. It coexists with the A record without any problem: the client prefers IPv6 if available, and otherwise falls back to IPv4 automatically.

What is the difference between SPF, DKIM and DMARC? SPF specifies who is allowed to send in your name, DKIM adds a digital signature proving the message was not altered, and DMARC ties the two together and decides what the recipient does when they fail and where to send reports. Together, the three are what keep your email out of spam.

What is a PTR record and why does it matter for email? PTR is the reverse DNS record that maps an IP address to a name, the opposite of the other records. Receiving mail servers check it: if the sender's address does not reverse-resolve to a sensible matching name, your messages are rejected or classified as spam. It is usually set by your hosting provider rather than you, so ask them to set it for your mail server.

Why can't you put a CNAME on the root domain? Because the root must carry SOA and NS records, and a DNS rule forbids mixing a CNAME with any other record for the same name. The alternative is an ALIAS or ANAME record (a flattened CNAME), which resolves the name internally and responds with an A record, or an explicit A record if the address is fixed.

How do I connect my domain to a CDN? For subdomains such as www or cdn, add a CNAME record pointing to the name your CDN provider gives you. For the root itself, use ALIAS/ANAME, because a CNAME is not allowed there. Read What is a CDN? to understand the full benefit before setting it up.

How do I check that a DNS change has propagated? Use the command dig example.com A +short or nslookup, or try a DNS propagation checker, which queries from multiple locations worldwide at once. To bypass your device's local cache, query a public resolver directly with dig @1.1.1.1 example.com. Different results in different locations mean propagation is under way and not yet complete.

What does DNS have to do with an SSL certificate? Some methods of verifying domain ownership to issue SSL work by adding a TXT record (the DNS-01 method), and a CAA record determines who is allowed to issue the certificate in the first place. Details in installing SSL and enabling HTTPS.

Why does my email go to spam? Usually because of missing or incorrect email authentication records (SPF/DKIM/DMARC) in TXT, or the lack of a correct reverse PTR record. Configure them precisely so mailbox providers trust your domain and deliver your messages to the inbox. Start DMARC with p=none and reports, then move gradually to reject.

Sources

Frequently asked questions

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

An A record maps a name directly to a numeric IP address, while a CNAME maps a name to another name (an alias), which in turn resolves to an IP. Use A for the root and for servers with fixed addresses, and CNAME for subdomains that follow an external name whose address changes, such as CDNs.

Why doesn't a DNS change show up immediately?

Because of TTL: resolvers and servers cache a copy of the record until its time runs out. Lower the TTL a day before a planned change to speed up propagation, and expect anywhere from minutes to hours for it to complete worldwide. Check with dig or an online checker instead of relying on your own device.

Which DNS record routes email?

The MX record. It specifies the mail server responsible for receiving your domain's messages and carries a priority number (the lower the number, the higher the priority). It is complemented by TXT records for security (SPF, DKIM and DMARC) and by the reverse PTR record on the sender's side to avoid rejection.

Do I need an AAAA record?

It is not mandatory, but it is useful if your server supports IPv6, so visitors on modern networks can reach it by the fastest route. It coexists with the A record without any problem: the client prefers IPv6 if available, and otherwise falls back to IPv4 automatically.

What is the difference between SPF, DKIM and DMARC?

SPF specifies who is allowed to send in your name, DKIM adds a digital signature proving the message was not altered, and DMARC ties the two together and decides what the recipient does when they fail and where to send reports. Together, the three are what keep your email out of spam.

What is a PTR record and why does it matter for email?

PTR is the reverse DNS record that maps an IP address to a name, the opposite of the other records. Receiving mail servers check it: if the sender's address does not reverse-resolve to a sensible matching name, your messages are rejected or classified as spam. It is usually set by your hosting provider rather than you, so ask them to set it for your mail server.

Why can't you put a CNAME on the root domain?

Because the root must carry SOA and NS records, and a DNS rule forbids mixing a CNAME with any other record for the same name. The alternative is an ALIAS or ANAME record (a flattened CNAME), which resolves the name internally and responds with an A record, or an explicit A record if the address is fixed.

How do I connect my domain to a CDN?

For subdomains such as www or cdn, add a CNAME record pointing to the name your CDN provider gives you. For the root itself, use ALIAS/ANAME, because a CNAME is not allowed there. Read What is a CDN? to understand the full benefit before setting it up.

How do I check that a DNS change has propagated?

Use the command dig example.com A +short or nslookup, or try a DNS and propagation checker that queries from multiple locations worldwide at once. To bypass your device's local cache, query a public resolver directly with dig @1.1.1.1 example.com. Different results in different locations mean propagation is under way and not yet complete.

What does DNS have to do with an SSL certificate?

Some methods of verifying domain ownership to issue SSL work by adding a TXT record (the DNS-01 method), and a CAA record determines who is allowed to issue the certificate in the first place. Details in Installing SSL and enabling HTTPS.

Why does my email go to spam?

Usually because of missing or incorrect email authentication records (SPF/DKIM/DMARC) in TXT, or the lack of a correct reverse PTR record. Configure them precisely so mailbox providers trust your domain and deliver your messages to the inbox. Start DMARC with p=none and reports, then move gradually to reject.