If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Domain Name System (DNS)

IP addresses are how computers identify other computers on the Internet. IP addresses aren't particularly human-friendly, though. Who wants to memorize an address like Or the even longer IP v6 addresses?
The Domain Name System (DNS) gives us humans an easy way to identify where we want to go on the Internet.
We simply type in a domain name like "www.wikipedia.org", and our computer connects us to the computers powering Wikipedia:
A domain name is a human-friendly address for a website, something that's easy for us to remember and type in.

Anatomy of a domain name

Each domain name is made up of parts:
There are a limited set of top level domains (TLDs), and many websites use the most common TLDs, ".com", ".org", and ".edu".
The second level domain is unique to the company or organization that registers it, like "wikipedia" or "khanacademy".
The third level domain is also called a subdomain, because it's owned by the same group and that URL often directs you to a subset of the website, like "m.wikipedia.org" (mobile-optimized Wikipedia) or "es.khanacademy.org" (Spanish-language Khan Academy).

Domains ↔ IP addresses

Behind the scenes, each domain name maps to an IP address. When we type a URL in the address bar of our browser, the computer has to figure out its IP address.
The computer can't store a database of more than 300 million domain names locally, so it goes through a multi-step process to find out the IP address.

Step 1: Check the local cache

If you've visited a website once, there's a fairly good chance you'll visit it again. That's why computers keep their own local cache of domain name to IP mappings. The cache stays small, because it kicks out domains you haven't visited in a while or domains that send down expiration dates.
🔍 In the Chrome browser, you can view the database yourself. Just type "chrome://net-internals/#dns" in the address bar.
Here's a snippet from my browser's cache:

Step 2: Ask the ISP cache

Every ISP (Internet Service Provider) provides a domain name resolving service and keeps its own cache. Perhaps you've never visited a particular website but your neighbor just did, so the ISP can lookup the domain name mapping from their visit.
If it's not in the ISP's cache, then it's off to the next step.

Step 3: Ask the name servers

There are domain name servers scattered around the globe that are responsible for keeping track of a subset of the millions of domain names.
The servers are ordered in a hierarchy:
Root name servers → TLD name servers → Host name servers.
The ISP starts by asking the root name servers: "hey, which name server knows about .org domains?" The root name server responds with the IP address of a TLD name server that tracks ".org" domains.
Next, the ISP asks the TLD name server: "so, who knows about wikipedia domains?" The TLD name server responds with the IP address of a host name server that contains the "wikipedia" records.
Finally, the ISP asks the host name server: "okay, so where's www.wikipedia.org?" The host name server responds with an exact IP address.
The ISP sends the IP address back to the requesting computer, and now our computer can successfully connect with the computer powering that domain.
If that sounds like quite a process: yes, it is! But don't worry, it's not done that often. A lot of information is cached along the way, so it's rare that a DNS lookup has to go through so many steps.
When a lookup does have to go through all the steps, there are multiple name servers that can answer each question, so a computer doesn't have to wait too long for a response or worry about a name server going down.
We've had the domain name system since 1985, and it's scaled impressively to match the growth of the Internet, thanks to its hierarchy, redundancy, and caching.
🙋🏽🙋🏻‍♀️🙋🏿‍♂️Do you have any questions about this topic? We'd love to answer—just ask in the questions area below!

Want to join the conversation?