
When you type a domain name in the browser the site opens within seconds; but behind the scenes a "translation" takes place. Computers find sites not by domain names but by IP addresses. The system that turns a domain name into an IP address is called DNS (Domain Name System). Most problems such as a site not opening, emails not arriving or a hosting change not showing relate to DNS. In this guide you learn what DNS is, how it works, the record types and how to fix common problems.
What is DNS?
Every server on the internet has an IP address (numbers such as 203.0.113.10). Because these are hard for people to memorise, domain names are used (for example example.com). DNS is a distributed system that answers the question "which IP address is example.com at?" The phone book comparison is common: you look up the name (domain) and find the number (IP address).
How does a DNS query work?
- 1
You type the domain name into the browser
- 2
The device looks at its cache and the DNS resolver
- 3
The resolver queries the root, the extension (.com) and the authoritative name servers in turn
- 4
The authoritative server gives the IP address
- 5
The browser connects to the server at that IP and fetches the page
The main players in this process:
- DNS resolver: usually your internet provider's server or that of a public DNS service you choose. It makes the query for you and caches the result.
- Root name servers: direct the query to the right extension server.
- TLD servers: servers responsible for extensions such as .com, .org and .uk.
- Authoritative name servers: servers that hold the domain's real records. They are usually at your domain or hosting provider.
Because results are cached, later visits are much faster. The cache time is set by the record's TTL value.
DNS record types
| Record | What it does | Example |
|---|---|---|
| A | Points the domain to an IPv4 address | example.com → 203.0.113.10 |
| AAAA | Points the domain to an IPv6 address | example.com → 2001:db8::1 |
| CNAME | Makes one name an alias of another | www → example.com |
| MX | Says which server email goes to | example.com → mail server (with a priority value) |
| TXT | Text information; verification, SPF, DKIM, DMARC | "v=spf1 ..." |
| NS | States the domain's authoritative name servers | ns1.provider.com |
| SRV | Server and port for certain services | Some communication services |
| CAA | Limits which certificate authorities can issue SSL | letsencrypt.org |
| PTR | Reverse lookup from IP to domain name | Important for email reputation |
A and AAAA records
The most basic records connecting your website to a server. Your hosting provider gives you an IP address; you point the A record to it.
The CNAME record
Links one name to another. For example, for www.example.com a CNAME can point to example.com. A CNAME usually can't be used on the root domain (example.com); instead an A record or a special record type the provider supports is used. There must not be both a CNAME and another record for the same name.
The MX record
States which server emails are delivered to. If there are several MX records the one with the lowest priority value is tried first. If your email is with Google Workspace, Microsoft 365 or your hosting provider you must enter the MX records the provider gives (see our custom domain email guide). A wrong MX record causes emails not to arrive.
The TXT record
Carries text-based information. The most common uses: domain ownership verification (such as Google Search Console) and the SPF, DKIM and DMARC email authentication records. Configuring these correctly reduces emails landing in spam (see our SPF, DKIM, DMARC guide).
The NS record
States which servers manage your domain's DNS. By changing the name servers at the place where you bought the domain you can move DNS management to another provider (such as hosting or a service like Cloudflare).
TTL and propagation time
TTL (Time To Live) states for how many seconds a record stays cached in resolvers. A short TTL (for example 300 seconds) lets changes spread quickly; a long TTL (for example 86400 seconds) keeps the cache a long time.
What we call "DNS propagation" is resolvers around the world dropping the old cache and learning the new record after a change. The time can vary from minutes to 24–48 hours depending on the TTL, the provider and a name server change. Name server (NS) changes usually take longer.
Tip: if you plan a large migration, lower the TTL a few days before the move and raise it again once the move is done. This reduces downtime (on cloud migration and changing hosting see our domain and hosting guide).
Public DNS services
Your device uses your internet provider's DNS by default. If you like you can switch to a public DNS service such as Google (8.8.8.8), Cloudflare (1.1.1.1) or Quad9 (9.9.9.9). This can affect speed, privacy and security (such as filtering malicious sites). DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT) encrypt queries. Still, changing DNS is no substitute for a VPN (see our VPN guide).
How to edit DNS records for a domain, step by step
- Sign in to your domain provider's or DNS management panel (the company where you bought the domain or a service hosting DNS such as Cloudflare).
- Save the existing records: take a screenshot or export the list.
- Decide which service you are adding a record for: website (A/CNAME), email (MX, SPF), verification (TXT).
- Add/change the record: name (host), type, value, TTL.
- Save and wait for propagation.
- Check (tools below).
- Review old, unused records; unnecessary records can create a security risk (for example a CNAME pointing to a service no longer used).
Checking DNS records
- Command line:
nslookup example.comordig example.com(macOS/Linux) shows the A record;dig MX example.comshows the MX record. - Online tools: there are many free DNS check and propagation check sites.
- Flushing the cache on Windows:
ipconfig /flushdns - On macOS: depending on version
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Browser cache: try a private window.
Common DNS problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The site won't open, "address not found" | A record missing/wrong, NS wrong, domain expired | Check the records and the domain's expiry |
| The old site shows | Cache, propagation not finished | Wait, clear the cache, try from a different network |
| Emails aren't arriving | MX record wrong or missing | Correct the MX records per the provider |
| Emails land in spam | SPF/DKIM/DMARC missing | Add the TXT records |
| www opens, the root domain doesn't | No A record for the root | Add an A record to the root domain |
| SSL error | DNS points to the wrong server or the certificate doesn't match | Check DNS and the certificate (see our SSL and HTTPS guide) |
| Opens on one network, not on another | Different DNS cache | Clear the cache, wait |
| CNAME conflict | A CNAME and another record on the same name | Remove the conflicting record |
DNS and security
- DNS spoofing: altering the reply to a query; DNSSEC reduces this risk by signing replies.
- Domain hijacking: protect your domain provider account with a strong password and two-factor authentication; turn on the registrar lock (see our domain and hosting guide).
- Dangling DNS records: old records pointing to unused services can be abused by attackers.
- Phishing domains: beware of fake look-alike domains (see our phishing guide).
- Public DNS filtering: there are DNS services that block malicious sites for a family or organisation.
DNS when moving hosting or a site
- Prepare the new server and confirm it works with the hosts file (local test).
- Lower the TTL beforehand.
- Turn the A record to the new IP.
- Keep the email records (MX, SPF) intact; even if hosting changes, email can stay elsewhere.
- Keep the old server up until propagation is complete.
- Check verification and SSL.
Frequently asked questions
How long does a DNS change take? Usually minutes to a few hours; in some cases 24–48 hours.
Are DNS and hosting the same thing? No. Hosting is the server where your site's files sit; DNS makes the domain point to that server.
My domain is in one place and my hosting in another; where should DNS be? Usually entering the hosting provider's name servers at the domain, or keeping DNS at the domain provider and pointing the A record to the hosting IP, is enough.
Will the internet get faster if I change DNS? It can improve query times a little; it doesn't raise download speed.
**What is a wildcard (*) record?** It directs undefined subdomains to a certain target; use it carefully.
What happens to DNS if I use a CDN? CDNs usually ask for their own name servers or a CNAME redirect (see our CDN guide).
Summary
DNS is the system that turns domain names into IP addresses and forms the basis of your site, email and verifications. Knowing the A, CNAME, MX and TXT records, understanding TTL and propagation and saving the existing records before changing them prevents most problems. If you hit trouble, check the records first, then the cache and finally the domain's expiry.
Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.