# What is DNS? The domain name system explained

> What DNS is, how a lookup works step by step, the servers involved, records, caching and TTL, DNSSEC and how DNS connects to hosting and email.

Source: https://comparehostingonline.com/guides/what-is-dns/

## Short answer

DNS, the domain name system, is the internet's phone book. It turns a name such as example.com into the IP address of the server that holds the site, and it also tells the world where your email goes. Records stored at your domain's nameservers hold those answers, and caching makes lookups fast.

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

At a glance

-   **What is DNS?** Computers find each other by numeric IP addresses, such as 203.0.113.10 or 2001:db8::10.
-   **How does a DNS lookup work?** Most lookups finish in milliseconds because a nearby resolver already has the answer.
-   **Which servers take part in DNS?** The authoritative nameservers for your domain are the ones you set at your registrar; see nameservers explained.

## What is DNS?

Computers find each other by numeric IP addresses, such as 203.0.113.10 or 2001:db8::10. People prefer names. DNS is the system that translates one into the other, so you can type example.com and reach the right server. It was designed in the 1980s and is defined in RFC 1034 and RFC 1035. It is distributed: no single computer holds every answer. Instead, responsibility is split into zones, each run by the owner of a domain or the company they chose.

DNS does more than find websites. It tells mail servers where to deliver email, proves that you own a domain to services that ask, and publishes the text records that help stop forged email. When DNS fails, sites and email can disappear even though the servers are running fine.

## How does a DNS lookup work?

Most lookups finish in milliseconds because a nearby resolver already has the answer. The full walk happens only the first time, or after a cached answer expires.

1.  1
    
    **Your device asks a resolver**
    
    Usually run by your internet provider or a public service.
    
2.  2
    
    **The resolver checks its cache**
    
    If it has a fresh answer it replies at once.
    
3.  3
    
    **Otherwise it walks the hierarchy**
    
    Root servers, then the .com servers, then your domain's nameservers.
    
4.  4
    
    **The authoritative nameserver answers**
    
    It returns the record, such as the IP address for the name.
    
5.  5
    
    **The resolver caches and replies**
    
    Your browser connects to the address.
    

## Which servers take part in DNS?

The authoritative nameservers for your domain are the ones you set at your registrar; see [nameservers explained](https://comparehostingonline.com/guides/nameservers-explained/).

| Part | Role |
| --- | --- |
| Stub resolver (your device) | Asks a recursive resolver and passes the answer to the application |
| Recursive resolver | Does the work of finding an answer and caches it |
| Root servers | Know where to find each top-level domain |
| TLD servers | Know which nameservers a domain uses (for .com, .org, .uk and so on) |
| Authoritative nameservers | Hold the records for a domain and give the official answer |

## What do DNS records contain?

Each record has a name, a type, a value and a time to live. The common types are A and AAAA for addresses, CNAME for aliases, MX for mail, TXT for text such as SPF and verification codes, and NS for the nameservers themselves. Our guide to [DNS records](https://comparehostingonline.com/guides/what-are-dns-records/) explains each type with examples, and our [DNS lookup tool](https://comparehostingonline.com/tools/dns-lookup/) shows the records a domain currently returns.

## What are caching and TTL?

Every record carries a TTL, the number of seconds resolvers may keep an answer. A long TTL reduces load and speeds up lookups but delays changes; a short TTL makes changes quick but increases queries. “Propagation” is just caches expiring at different times. Lower the TTL a day before a planned change, make the change, then raise it again. Your browser and operating system also keep their own short-lived caches, which is why a private window or another network sometimes shows the change first.

## How does DNS connect to hosting and email?

-   Hosting: the A or AAAA record points your domain to the server; see [how to point a domain to your hosting](https://comparehostingonline.com/guides/point-domain-to-hosting/).
-   Email: MX records choose the mail server, and SPF, DKIM and DMARC records help receivers trust your mail; see [email hosting vs web hosting](https://comparehostingonline.com/guides/email-hosting-vs-web-hosting/).
-   Security certificates: certificate authorities check DNS or the server to confirm you control a domain; see [what an SSL certificate is](https://comparehostingonline.com/guides/what-is-an-ssl-certificate/).
-   CDNs and proxies: you change nameservers or records to route traffic through them; see [what a CDN is](https://comparehostingonline.com/guides/what-is-a-cdn/).
-   Moves: DNS is the switch that points visitors to a new host; see the [website migration checklist](https://comparehostingonline.com/guides/website-migration-checklist/).

## What is DNSSEC and is DNS secure?

Plain DNS has no built-in proof that an answer is genuine, so attackers can try to forge answers, a problem known as cache poisoning. DNSSEC adds digital signatures to records so that a validating resolver can tell whether an answer is authentic. It is optional, needs support from the registrar and DNS provider, and a misconfiguration can make a domain fail to resolve, so follow your provider’s guide when you enable it or change providers. Other protections include DNS over HTTPS and over TLS, which encrypt the query between your device and the resolver.

## How do you troubleshoot DNS problems?

-   Look up the exact name and record type with a lookup tool and compare the result with what you expect.
-   Query the authoritative nameserver directly to see the true value, then a public resolver to see what the world sees.
-   Check for a typo, a missing www record or a CNAME where other records exist.
-   Wait for the old TTL to expire before assuming a change failed.
-   Check that the nameservers at the registrar are the ones where you edited records.
-   Check DNSSEC if validating resolvers fail but others work.

## What are the common mistakes?

-   Changing nameservers without copying every record, so email stops.
-   Editing records at a provider that is not the authoritative one.
-   Leaving a long TTL before a migration.
-   Forgetting that example.com and [www.example.com](http://www.example.com) are different names.
-   Deleting records you do not recognise, such as verification TXT records that a service still uses.

## A worked example: what happens when you type a web address

You type [www.example.com](http://www.example.com) in your browser. The browser checks its own cache and then asks the operating system, which checks its cache and then your resolver. The resolver has no answer, so it asks a root server where to find the .com servers, asks a .com server which nameservers hold example.com, and asks one of those for the A record of [www](http://www). The answer comes back as an address with a TTL of 300 seconds. The resolver stores it for five minutes and gives it to your computer, which connects to that address over HTTPS and asks for the page.

If you reload a minute later, none of this repeats: the answer is already in cache. If the site owner changes the address, you will keep using the old one for up to five minutes. If the same resolver serves many people, they all benefit from the first lookup, which is why DNS scales so well.

## Who runs your DNS: registrar, host or a dedicated provider?

The choice is made by the nameservers you set at the registrar. Our [nameservers guide](https://comparehostingonline.com/guides/nameservers-explained/) explains how to change them safely, and [do you need Cloudflare?](https://comparehostingonline.com/guides/do-you-need-cloudflare/) covers the most common dedicated option.

| Where DNS lives | Good for | Watch out for |
| --- | --- | --- |
| Registrar | Keeping DNS separate from hosting under one login | Features may be basic |
| Web host | Automatic records for site and email | Moving hosts means moving DNS |
| Dedicated DNS or CDN provider | Speed, security and independence | Another account and settings to manage |

## Sources and further reading

-   [RFC 1034: Domain names, concepts and facilities](https://www.rfc-editor.org/rfc/rfc1034)
-   [RFC 1035: Domain names, implementation and specification](https://www.rfc-editor.org/rfc/rfc1035)
-   [MDN: DNS glossary entry](https://developer.mozilla.org/en-US/docs/Glossary/DNS)
-   [Cloudflare DNS documentation](https://developers.cloudflare.com/dns/)

## Common questions

What is DNS in simple terms?

It is the internet's phone book. It turns a domain name such as example.com into the IP address of the server that hosts the site, and it tells the world where your email goes. Records stored at your nameservers hold those answers.

What does a DNS server do?

A recursive resolver finds answers for your device and caches them. An authoritative nameserver holds the official records for a domain and answers questions about it. Together they make a lookup finish in milliseconds.

How long do DNS changes take?

Usually minutes to a few hours, up to a day or two in some cases, because resolvers cache answers until the TTL expires. Lowering the TTL a day before a planned change makes it faster.

What is the difference between DNS and web hosting?

DNS finds the server by turning a name into an address. Hosting is the server that stores and serves the site. You need both, and they can be at different companies.

Is DNS secure?

Plain DNS has no built-in authentication. DNSSEC adds signatures so validating resolvers can detect forged answers, and DNS over HTTPS or TLS encrypts queries. Use a reputable provider and enable the protections it supports.

## Related

[What are DNS records?](https://comparehostingonline.com/guides/what-are-dns-records/) [Nameservers explained](https://comparehostingonline.com/guides/nameservers-explained/) [DNS lookup tool](https://comparehostingonline.com/tools/dns-lookup/)

## More guides

[How to start a web hosting business: models, costs, legal basics and first customers](https://comparehostingonline.com/guides/how-to-start-a-web-hosting-business/) [Why hosting renewal prices jump, and how to avoid it](https://comparehostingonline.com/guides/why-hosting-renewal-prices-jump/) [What 99.9% uptime really means](https://comparehostingonline.com/guides/what-99-9-uptime-means/) [How to transfer a WordPress site to a new host](https://comparehostingonline.com/guides/transfer-wordpress-to-new-host/) [What is cPanel?](https://comparehostingonline.com/guides/what-is-cpanel/) [VPS or shared hosting: which should you choose?](https://comparehostingonline.com/guides/vps-or-shared-hosting/)

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.
