What Is DNS and How Does It Work?
The Domain Name System (DNS) is the internet's address book. It translates human-friendly names like example.com into the numeric IP addresses computers use to find each other. Without it you would have to memorize a string of digits for every site you visit.
What DNS actually is
DNS is a globally distributed, hierarchical database. No single server holds every name on the internet. Instead, responsibility is delegated across many servers, each authoritative for a small slice of the namespace. This design lets DNS scale to billions of names while staying fault-tolerant: if one part of the tree is unreachable, the rest keeps working.
What you look up is a domain name, and the answer is usually a resource record such as an IP address. A domain name is read right to left in levels: in www.example.com, the trailing dot (often implied) is the root, com is the top-level domain (TLD), example is the registered second-level domain, and www is a subdomain. Each level can delegate control of the level below it to a different operator.
How a DNS lookup works, step by step
When you type a name into a browser, your device does not query the whole internet at once. It hands the name to a recursive resolver (usually run by your ISP or a public service) whose job is to do the legwork and return a final answer. Here is the typical sequence for a name not yet cached:
- Client to resolver: Your operating system asks the configured recursive resolver to find the address for
www.example.com. - Resolver to a root server: The resolver asks a root name server, which does not know the answer but replies with a referral to the servers responsible for the
comTLD. - Resolver to the TLD servers: The resolver asks a
comserver, which refers it to the authoritative name servers forexample.com. - Resolver to the authoritative servers: The resolver asks
example.com's authoritative server, which returns the actual record, for example the IP address forwww. - Resolver to client: The resolver caches the answer and returns it to your device, which then opens a connection to that IP.
This is called recursive resolution backed by iterative queries: the client makes one request and waits while the resolver iterates through the hierarchy on its behalf. The whole exchange usually completes in a fraction of a second.
The common record types
DNS stores more than IP addresses. Each record has a type that tells the resolver what kind of data to expect. The ones you encounter most often are these.
| Type | Purpose |
|---|---|
| A | Maps a name to an IPv4 address |
| AAAA | Maps a name to an IPv6 address |
| CNAME | Aliases one name to another canonical name |
| MX | Specifies the mail servers that accept email for the domain |
| TXT | Holds arbitrary text, used for SPF, DKIM, and domain verification |
| NS | Delegates a zone to its authoritative name servers |
A single name can carry several records at once. A domain might publish both an A and an AAAA record so clients can reach it over IPv4 or IPv6. When assembling records for a new domain, a DNS Record Builder helps you format each line correctly before you paste it into your provider, and an IP Address Converter is handy for switching between IPv4 and IPv6 notations.
Caching, TTL, and why changes take time
Every DNS record carries a Time To Live (TTL), a number of seconds telling resolvers how long they may cache the answer before asking again. Caching is what makes DNS fast: once a resolver has learned an address, it answers repeat queries instantly without walking the hierarchy again. Browsers and operating systems keep their own caches on top of that.
The trade-off appears when you change a record. If a name has a TTL of one hour, resolvers may keep serving the old value for up to an hour after you update it. This is why DNS changes seem to take effect at different times for different people, a phenomenon loosely called propagation. There is no central push of updates; old cached entries simply expire on their own schedule. Before a planned migration, lower the TTL well in advance so the cache window is short when you make the cutover.
Why DNS matters beyond addresses
DNS underpins far more than basic web browsing. Email delivery depends on MX records, and anti-spam standards such as SPF, DKIM, and DMARC are all published as DNS records. Many TLS certificate authorities verify domain ownership by asking you to publish a specific TXT record. Content delivery networks and load balancers use DNS to steer users toward the nearest or healthiest server, sometimes returning different answers depending on where the query comes from.
Because so much trust rides on DNS, security extensions exist to protect it. DNSSEC adds cryptographic signatures so a resolver can verify that an answer genuinely came from the authoritative source and was not tampered with in transit. Separately, DNS over HTTPS (DoH) and DNS over TLS (DoT) encrypt the query between your device and the resolver so a network observer cannot see or alter which names you look up. You can try encrypted queries with a DNS over HTTPS Lookup tool.
Common pitfalls and how to avoid them
Most DNS trouble comes from a handful of recurring mistakes. Knowing them saves hours of debugging.
- Expecting instant changes: A high TTL means old answers linger. Check the record's TTL before assuming an update failed, and lower it ahead of changes.
- Misusing CNAME at the apex: A CNAME cannot coexist with other records on the same name, so it generally cannot sit on the bare domain (the zone apex) where SOA and NS records already live. Use an A or AAAA record there, or a provider-specific alias feature.
- Stale local cache: Your own machine may hold an outdated entry. Flushing the OS resolver cache or testing from a different network rules this out quickly.
- Querying the wrong layer: A name can resolve correctly while the service behind it is down. Confirm the returned IP actually answers by checking its HTTP response headers, and verify the certificate matches with an SSL Certificate Decoder.
- Forgetting both IP families: If you publish only an A record, IPv6-only clients cannot reach you; publish AAAA too where applicable.
DNS rewards a mental model over memorized commands. Once you picture the hierarchy of root, TLD, and authoritative servers, the resolver doing the walking, and TTL governing how long answers stick, almost every real-world symptom maps onto one of those moving parts.
Frequently Asked Questions
DNS stands for Domain Name System. It is the distributed directory that translates human-readable domain names such as example.com into the numeric IP addresses that computers use to connect.
A recursive resolver does the work of finding an answer by querying other servers on your behalf and caching the result. An authoritative name server holds the actual records for a specific domain and gives the definitive answer for it.
Each record has a TTL (Time To Live) that tells resolvers how long to cache it. Until that cached copy expires, resolvers keep serving the old value, so a change can appear at different times for different users. Lowering the TTL before a change shortens this window.
An A record maps a name directly to an IPv4 address. A CNAME maps a name to another canonical name, which is then resolved separately. A CNAME generally cannot be used on the zone apex because it cannot coexist with other required records.
Traditional DNS queries are sent in plaintext. DNS over HTTPS (DoH) and DNS over TLS (DoT) encrypt the query between your device and the resolver, and DNSSEC adds signatures so answers can be verified as authentic. You can try encrypted lookups with our DNS over HTTPS Lookup tool.