
DNS records are the instructions that connect your domain name to the services behind it. An A record points the domain to your web server's IP address, a CNAME makes one name an alias of another, MX records route email, and TXT records prove ownership and protect your email from spoofing. When you change a record, the update spreads according to its TTL, which is why changes can take minutes or hours. This guide explains each record type with real examples and shows how to change DNS safely without taking your website or email down.
- Nameservers decide where your DNS is managed; records decide what your domain points to.
- Website: A (and AAAA) or CNAME. Email: MX plus SPF, DKIM and DMARC TXT records.
- Lower the TTL to 300 seconds a day before a planned change, then raise it again afterwards.
- Copy every existing record before switching nameservers, or email can stop working.
DNS records: how DNS works in 30 seconds
When someone types your domain, their device asks a recursive resolver (usually run by their ISP, or a public one like 1.1.1.1 or 8.8.8.8). The resolver asks the root servers, then the servers for the extension (such as .com or .pk), which reply with your domain's nameservers. Your nameservers hold the actual records and answer with the IP address. The resolver caches that answer for the record's TTL, so the next visitor gets it instantly. Also, this matters for DNS records on every kind of site.
This is why there are two separate places to check: the registrar, where the nameservers are set, and the DNS host (often your hosting company or Cloudflare), where the records live. For domain basics, see our domains and hosting guide.
The DNS record types you will actually use
| Type | What it does | Example value |
|---|---|---|
| A | Points a name to an IPv4 address | 203.0.113.25 |
| AAAA | Points a name to an IPv6 address | 2001:db8::25 |
| CNAME | Makes a name an alias of another name | www → example.com |
| MX | Says which servers receive email, with a priority | 10 mx1.mailprovider.com |
| TXT | Free text: verification, SPF, DKIM, DMARC | v=spf1 include:_spf.google.com ~all |
| NS | Lists the nameservers for a domain or subdomain | ns1.dns-parking.com |
| CAA | Limits which authorities may issue SSL certificates | 0 issue "letsencrypt.org" |
| SRV | Locates services such as SIP or Microsoft 365 features | _sip._tls 100 1 443 sipdir.online.lync.com |
A and AAAA records: pointing to your server
The A record is what makes your website load. The root of the domain (often written as @) usually has an A record to the hosting server's IP address: So keep this in mind whenever you work on DNS records.
Type Name Value TTL
A @ 203.0.113.25 3600
AAAA @ 2001:db8::25 3600
Only add an AAAA record if your host gives you an IPv6 address and the site actually works over IPv6. A broken AAAA record makes the site fail for some visitors on IPv6 networks while it looks fine for you.
CNAME records: aliases
A CNAME says "this name is the same as that name". It is used for www, for subdomains that point to services like Shopify or a CDN, and for verification records. In short, it is one of the simplest ways to get DNS records right.
Type Name Value TTL
CNAME www example.com. 3600
CNAME shop shops.myshopify.com. 3600
Two rules matter:
- A name with a CNAME cannot have any other record. That is why you normally cannot put a CNAME on the root domain, which also needs MX and NS records.
- Some providers, including Cloudflare, offer CNAME flattening or ALIAS/ANAME records that act like a CNAME at the root by returning the IP addresses directly.
MX records: where email goes
MX records point to mail servers, never to an IP address directly. The number is the priority: lower numbers are tried first.
Type Name Priority Value
MX @ 1 smtp.google.com.
MX @ 10 mx1.hostinger.com.
MX @ 20 mx2.hostinger.com.
Use the MX records from one email provider only (the example above mixes two to show priorities). If old MX records from a previous host stay in place, some messages will be delivered to the wrong mailbox. Our business email guide covers choosing a provider.
TXT records: SPF, DKIM, DMARC and verification
TXT records carry text that other systems read. Three of them decide whether your email lands in the inbox or spam:
| Record | Name | Example |
|---|---|---|
| SPF | @ | v=spf1 include:_spf.google.com ~all |
| DKIM | google._domainkey | v=DKIM1; k=rsa; p=MIIBIjANBg... |
| DMARC | _dmarc | v=DMARC1; p=none; rua=mailto:dmarc@example.com |
- Have only one SPF record per domain. If you use two senders, merge them:
v=spf1 include:_spf.google.com include:servers.mcsv.net ~all. - SPF allows at most 10 DNS lookups. Too many
include:entries make it fail silently. - Start DMARC at
p=noneto collect reports, then move toquarantineandrejectonce all legitimate senders pass. Gmail and Yahoo require DMARC for bulk senders.
Google Search Console, Meta Business and Microsoft 365 also ask you to add a TXT record to prove you own the domain. These are safe to leave in place.
TTL and propagation: why changes take time
TTL (time to live) is how many seconds resolvers may cache a record. A TTL of 3600 means a resolver that looked up your domain one minute before your change may keep using the old IP address for up to an hour.
- Record changes usually reach most visitors within the old TTL, often minutes.
- Nameserver changes depend on the TLD's own TTL and commonly take a few hours, sometimes up to 24 to 48 hours.
- "Propagation" is not a push; it is caches expiring around the world at different times.
Before a planned move, lower the TTL to 300 (five minutes) at least one old-TTL period in advance. After the change is stable, set it back to 3600 or higher to reduce lookups.
How to check DNS records
From Windows PowerShell or Command Prompt:
nslookup -type=A example.com
nslookup -type=MX example.com
nslookup -type=TXT _dmarc.example.com 8.8.8.8
From macOS or Linux:
dig example.com A +short
dig example.com MX +short
dig @1.1.1.1 example.com TXT
Querying a specific public resolver (8.8.8.8 or 1.1.1.1) shows what the rest of the internet sees, rather than your own cached answer. Online tools such as DNS Checker show results from many countries at once, which is useful during propagation. You can also use our free website tools.
DNS records: how to change DNS without downtime
- Export or screenshot every existing record, including MX, TXT and any subdomains.
- Lower TTLs to 300 a day before the change.
- Prepare the new server fully: website files, database, SSL certificate and email accounts.
- Change the record (or the nameservers, after recreating every record at the new DNS host).
- Keep the old server running for 48 hours so visitors with cached records still see a working site.
- Verify with
digornslookupagainst public resolvers, test email in both directions, and check the SSL certificate. - Raise TTLs again once everything is stable.
DNS records: frequently asked questions
What is the difference between nameservers and DNS records?
Nameservers, set at your registrar, choose which company answers DNS for your domain. Records, set at that company, say where the website and email actually are.
Should www be an A record or a CNAME?
Either works. A CNAME to the root domain is easier because you only update one IP address if the server changes.
Why does my site work on mobile data but not on Wi-Fi?
Different networks use different resolvers, and one may still have the old record cached. Wait for the TTL to expire, or flush your device's DNS cache with ipconfig /flushdns on Windows.
What does a CAA record do?
It lists which certificate authorities may issue SSL certificates for your domain. If you add one, include every authority you use, or certificate renewals will fail.
Related guides: 404 Error, 403 Forbidden Error and ERR_TOO_MANY_REDIRECTS.
For official guidance, see MDN Web Docs.
Need help with DNS or a hosting move?
We set up DNS, email authentication and hosting moves without downtime. See our web hosting service and maintenance plans, or contact us.
Written by the ItsWebExpert team, a web design and development company in Karachi building websites, online stores and apps for businesses across Pakistan.
Ask a Question on WhatsApp