DNS Basics: How Domain Names Find Your Website
DNS, the Domain Name System, is the internet's address book. Computers find each other by IP addresses such as 203.0.113.10 or long IPv6 addresses. People prefer names like example.com. DNS translates names into the information computers need, and it does this billions of times a day so quickly that most people never notice it exists.
If you run a website, you will eventually need to change a DNS record: to point your domain at a new host, to set up email, or to prove to a service that you own the domain. Knowing the basics turns a scary settings page into a short checklist.
What happens when someone visits your site
When a visitor types your domain into a browser, their device asks a resolver, usually run by their internet provider or a public service, for the address. If the resolver does not already have the answer saved, it works its way down the hierarchy: it asks the root servers who handles .com, then asks the .com servers who handles example.com, and finally asks your domain's authoritative nameservers for the actual record. The answer comes back, the resolver saves it for a while, and the browser connects to the server at that address.
The important part for you is the last step. Whoever runs your authoritative nameservers controls your DNS. That might be your registrar, your host, or a DNS provider like Cloudflare.
Nameservers vs records
These two things cause most of the confusion.
- Nameservers are set at your registrar. They say which company's DNS servers are in charge of the domain. Changing nameservers moves your entire DNS to another provider.
- Records live at whichever provider the nameservers point to. They hold the actual answers: where the website is, where email goes, and so on.
If you edit records at a company that is not your current nameserver provider, nothing will happen, because the internet is not asking that company. When a change seems to do nothing, check this first.
The record types you will meet
- A record: points a name to an IPv4 address. Example: example.com → 203.0.113.10.
- AAAA record: the same thing for an IPv6 address.
- CNAME record: points a name to another name instead of an address. Example: www.example.com → example.hosting-provider.net. Traditional DNS does not allow a CNAME at the bare domain (the "apex"), so some providers offer a workaround called CNAME flattening or ALIAS records.
- MX record: tells other mail servers where to deliver email for your domain. Each MX has a priority number; lower numbers are tried first.
- TXT record: holds free text. It is used for email security (SPF, DKIM and DMARC) and for proving domain ownership to services such as Google Search Console.
- NS record: lists the nameservers for a domain or subdomain.
- CAA record: says which certificate authorities may issue SSL certificates for your domain. Optional, but useful for security.
TTL and "propagation"
Every record has a TTL (time to live), measured in seconds. It tells resolvers how long they may keep a cached copy. With a TTL of 3600, a resolver may keep giving out the old answer for up to an hour after you change it.
This is what people mean by "DNS propagation". Nothing is being pushed around the world; caches are simply expiring at different times. Nameserver changes at the registrar can take longer, often up to a day or two, because the TLD's own records have long TTLs.
A good habit before a planned move: lower the TTL on the records you will change to something like 300 seconds a day ahead. When you switch, caches clear within minutes. Raise it again afterward.
Email records deserve extra care
Website records and email records are independent. You can move your website to a new host and keep email exactly where it is, as long as you leave the MX and email-related TXT records alone. A common mistake during a move is changing nameservers to a new provider that has not copied the old MX records, which quietly breaks email. Before switching nameservers, copy every existing record to the new provider and compare them line by line.
For email to land in inboxes rather than spam folders, you will usually want:
- SPF: a TXT record listing which servers may send mail for your domain.
- DKIM: a TXT record with a public key that lets receivers verify your messages were signed by your mail service.
- DMARC: a TXT record telling receivers what to do with mail that fails SPF and DKIM, and where to send reports.
How to check your DNS
You do not need special software. On a Mac or Linux computer, the dig command shows records, for example dig example.com A or dig example.com MX. On Windows, nslookup does a similar job. Web-based DNS lookup tools let you see what public resolvers return from several places at once, which helps when you are waiting on a change.
Troubleshooting checklist
- Confirm which nameservers are actually set for the domain.
- Make sure you are editing records at that provider.
- Check for typos, extra dots and records on the wrong name (example.com vs www.example.com).
- Remember the TTL; wait at least that long before deciding a change failed.
- Make sure there is not an old record still competing with the new one.
- For email, check that MX, SPF and DKIM records exist at the current provider.
The short version
DNS turns names into addresses. Nameservers decide who answers for your domain; records hold the answers. A and CNAME records point your website, MX records route email, and TXT records prove ownership and protect mail. Copy everything before you switch providers, lower TTLs before planned changes, and most DNS problems become easy to fix. Next, read SSL certificates explained or how to move a website to a new host.