There are two hierarchical addressing systems on the Internet: domain names and IP addresses. People use domain names (like snap.berkeley.edu) to visit websites. Computers translate those domain names to IP addresses (like 128.32.189.18) to locate and send data behind the scenes.
A hierarchy is an arrangement of things with the broadest or highest category at the top and things ranked into subcategories below. A hierarchy is often depicted as a pyramid.
Before the Internet, there were only small networks of computers (like the Arpanet which peaked at around 200 computers), and every computer knew the name of all the other computers on the network. That worked for small networks, but it's not realistic for the 3 billion computers on the Internet now. So now, a hierarchy allows the system to distribute requests for IP addresses to domain name servers across the growing network.
Recall the structure of a URL:
Just as the path in a URL locates a specific file in a hierarchy of folders on the server, domain names locate a specific website within a hierarchical domain name system (DNS). The hierarchy of the domain name system simplifies the process of finding the computer with the desired domain name because the DNS servers that help locate domains don't need enormous lists with every host name in the world. Instead, any user's computer only has to know where to find a root domain server (the one that knows where to find the top-level domains such as .org and .edu), and that server knows where to find the domain (like berkeley.edu), and that server knows where its subdomains are (like snap.berkeley.edu), and so on.
The root domain may be a country code (such as .mx for Mexico) or a category code (like .gov for government). The last two segments of a domain name (like berkeley.edu) make up the primary domain, the main address for a site. Subdomains are subsections of primary domains or of other subdomains. For example:
When we type in a domain name, the browser queries the domain name system to find the Internet Protocol (IP) address of the server we want to visit. IP addresses are unique numerical addresses assigned to every device on the Internet. Both the domain name syntax and IP addresses are hierarchical; however unlike domain names, IP addresses are hierarchical from right to left (see right).