Wesloo
All topicsTopics

The internet

What is DNS and How Does It Work?

Short answer

DNS is the system that translates human-readable domain names into the IP addresses computers use to find each other on a network. It works as a distributed, hierarchical database with caching, so browsers can load sites without users remembering numeric addresses.

Key points

  • DNS maps domain names to IP addresses.
  • Resolution uses root, top-level, and authoritative servers.
  • Recursive resolvers and caches speed repeated lookups.
  • Common records include A, AAAA, MX, CNAME, NS, and PTR.
  • DNS over TLS and DNS over HTTPS encrypt transfer without changing resolution.

What is DNS in plain terms?

People asking what is DNS usually want the service that connects domain names with resources across the Internet and other networks. It turns human-readable names into numeric IP addresses, letting a browser reach a server without the user entering a number like 192.0.2.1. A common analogy calls DNS the phonebook of the Internet: it stores the mapping between a name people can remember and the address a machine needs. A more modern analogy compares DNS to a smartphone contact list, because both remove the need to remember raw numbers. When someone types www.example.com, DNS returns the IP address of the server that hosts that site, and the browser then connects to that server.

DNS is not a single central machine. It is a distributed and fault-tolerant service built as a hierarchical database. That design lets the system grow with the network and keep working when parts of it are unavailable. The hierarchy begins at the root level, shown as a dot, then splits into top-level domains such as .com, .org, and .net, plus country-code domains such as .uk and .jp, and then into second-level domains such as example.com. Because no single server holds every record, updates can be made in one place and the rest of the system can find them through referrals.

How does DNS resolution work?

Resolution is the process of turning a domain name into an IP address. It usually happens in several steps, and caching can shorten or skip some of them.

  1. User input: a person enters a domain name such as www.geeksforgeeks.org into a browser.
  2. Local cache check: the browser or operating system checks whether it already has a stored IP address for that name.
  3. DNS resolver query: if no cached answer exists, the request goes to a DNS resolver, often run by an internet service provider or a third-party DNS service.
  4. Root server query: the resolver asks a root server, which points it to the correct top-level domain server.
  5. TLD server response: the resolver is referred to the domain's authoritative server by the TLD server.
  6. Authoritative server response: the domain's authoritative server supplies the requested IP address.
  7. Final response: the resolver returns the IP address to the user, and then the browser connects to the server.

Recursive servers, also called recursive resolvers or DNS resolvers, do the work of following referrals from root to TLD to authoritative server. They are usually run by ISPs or third-party DNS providers, and an organization can operate its own resolver. Authoritative servers are the ones that hold the final records for a domain. Most name servers are second-level domain servers, and they store zone files that include the IP address for a complete domain name. This split between asking and answering keeps the system organized: resolvers handle client questions, while authoritative servers hold the official data.

What records does DNS store?

A domain name server keeps DNS records and responds to queries that turn domain names into IP addresses. The server can perform either recursive or authoritative functions within the hierarchical structure. Common record types include A, AAAA, MX, CNAME, NS, and PTR. An A record maps a name to an IPv4 address, while AAAA maps a name to an IPv6 address. MX records point to mail servers, CNAME records create aliases, NS records identify authoritative name servers, and PTR records support reverse lookups from an IP address back to a name.

RecordPurpose
AMaps a domain name to an IPv4 address
AAAAMaps a domain name to an IPv6 address
MXDirects email to the right mail server
CNAMECreates an alias from one name to another
NSIdentifies authoritative name servers for a domain
PTRSupports reverse lookup from IP address to name

Each record has a time to live, or TTL, that tells caches how long they may keep the answer. A TTL of 3600 seconds keeps the record in cache for one hour before refresh is required. This is a simple but important control: a short TTL lets changes spread quickly, while a longer TTL reduces repeated queries. Administrators choose TTL values based on how often a service moves and how much query traffic they want to avoid.

Why does caching matter?

DNS speeds things up by caching answers, which cuts lookup time for repeated requests. After a resolver learns an IP address, it can answer the same question again without repeating the full chain of root, TLD, and authoritative queries. Browsers and operating systems also keep their own caches, so a frequently visited site may not need a network lookup at all. Caching is one reason DNS can handle a rapidly expanding network of computers without becoming a bottleneck. It also means that a changed IP address may not appear everywhere immediately; caches wait for the TTL to expire before fetching the new value. When troubleshooting a site that points to an old address, the delay is often caused by a cache rather than by the DNS record itself.

Who runs the different DNS servers?

Recursive resolvers are usually operated by ISPs or third-party DNS providers, and an organization can run its own. Authoritative servers are usually managed by the domain owner, a hosting provider, or a DNS service. Root and top-level domain servers are operated by organizations responsible for those levels of the hierarchy. This division of labor is what makes DNS distributed: no single company or server has to answer every question on the Internet. It also means that a problem at one level, such as an authoritative server outage, can affect only the domains it serves rather than the whole system.

How does DNS fit with the rest of the Internet?

DNS sits between a user's intent and the network's addressing system. It does not move web pages, files, or email; it only supplies the address needed to start a connection. Once the browser has the IP address, it can request the page from the server. For a broader view of how packets, routers, and protocols fit together, see How Does the Internet Work? A Guide. If a site fails to load because an old address is stored locally, clearing the browser cache can force a fresh lookup; see How to clear browser cache on any device.

What about privacy and "private DNS"?

The phrase "private DNS" is often used loosely. The term is occasionally used for encrypted lookups, including DNS over TLS (DoT) and DNS over HTTPS (DoH). These are better described as privacy features or privacy protocols, not as private DNS. The resolution process stays the same: a resolver still queries the public DNS to get what it needs. The difference is that the transfer is encrypted, which makes it harder for others on the network to read or alter the query. This distinction matters because encryption protects the conversation, while the underlying directory still works the same way.

What happens when a name cannot be resolved?

If no record exists for a domain, or if a resolver cannot reach the authoritative servers, the browser cannot obtain an IP address and the connection fails. The user may see a DNS error or a message that the server cannot be found. Because DNS is distributed, a failure can be local, such as a misconfigured resolver, or specific to one domain, such as an expired registration or a broken authoritative server. Checking the spelling of the name, trying another resolver, or waiting for a cache to expire are common first steps. These steps do not change DNS itself; they only change where or when the question is asked.

Questions people also ask

Is DNS the same as a web server?

No. DNS returns the address needed to reach a service, while the web server sends the actual page or file.

Why do websites sometimes load after a delay?

A browser may need to query resolvers and wait for cached answers to expire; repeat visits are usually faster because of caching.

Does encrypted DNS change how names are resolved?

No. DNS over TLS and DNS over HTTPS encrypt the transfer, but the resolver still uses the public DNS process.

What is a DNS resolver?

A DNS resolver is a server that receives client queries and follows referrals to find the final IP address.

Why is DNS called the phonebook of the Internet?

It maps memorable domain names to numeric IP addresses, much like a contact list maps names to phone numbers.

Related pages

  • Cloud Computing: What It Is and How It Works

    Cloud computing is on-demand access to computing resources over the internet, usually priced by use. It replaces buying and running physical servers with renting capacity from a provider. Users can scale storage, compute, and software up or down as needs change.

  • How Wi-Fi Works: Radio Waves to Router

    Wi-Fi sends data as radio waves between a device and a router. The router connects that local wireless network to the wider internet. Standards such as IEEE 802.11 define how devices share frequencies, range, and security rules.

  • What is an IP address and how it works

    An IP address is a numeric identifier given to a device on a network that communicates with the Internet Protocol. It identifies the device and helps locate it for communication. IPv4 and IPv6 are the two versions in use today.

  • What is net neutrality? A plain guide

    Net neutrality is the principle that internet service providers should treat all online traffic equally, without favoring or blocking particular sites, apps, or services. It shapes how broadband companies manage speed, access, and fees. Supporters and critics disagree about whether extra rules help or harm investment, competition, and access.

  • How Does Email Work? From Send to Inbox

    Email moves a message from a sender's mail program to a recipient's inbox through mail servers and standard protocols. The sending server looks up the recipient's domain, finds its mail exchanger, and hands off the message for storage. The recipient then reads it with a mail client or webmail, often through IMAP or POP.

  • What Is a VPN and How Does It Work?

    A VPN is a service that builds an encrypted tunnel between your device and a remote server, then sends your internet traffic through that server. It can hide your IP address and shield activity on untrusted networks, but it does not make you anonymous to the VPN provider or to websites you log into.

How this page was prepared

Before writing, the topic was researched in the sources below. The page then passed automatic quality checks.

Report a mistake on this page