Skip to content
Announcing the new Pro Zone. Check it out!

DNS Hierarchy – What Is Domain Name System Hierarchy?

A DNS Hierarchy is a system used to sort the parts of a domain according to their importance.

In www.codesweetly.com, for instance, the DNS Hierarchy tree would be as shown below:

DNS hierarchy
tree

DNS Hierarchy = Root Level Domain → Top Level Domain → Domain name → Subdomain

Let’s discuss each part of the DNS Hierarchy tree.

Root-Level Domain

The root-level domain ("") is the highest hierarchy level of any domain name system.

In order words, the root-level domain is the primary directory (folder) where all other directories reside. It is the parent folder of the top-level domain and all its contents.

Keep in mind that the root-level domain does not have a name. So, technically, its name is an empty string ("").

Top-Level Domain

The top-level domain (TLD) is what follows the domain name in a URL.

For instance, in codesweetly.com, com is the top-level domain.

TLD’s initial purpose was to help classify websites based on their purposes, ownership, or geographical origin.

In other words, the initial intent for each TLD was like so:

  • “com” for commercial websites,
  • “org” for organizational websites,
  • “edu” for educational websites,
  • “net” for network organizations,
  • “gov” for governmental websites,
  • “ca” for Canadian websites,
  • “au” for Australian websites,
  • “mil” for military websites, and so on.

However, IANA has abandoned the restrictions on most TLDs due to the exponential growth of the internet. Only a few ones—like “edu”, “gov”, and “mil”—remain restricted for educational, governmental, and military purposes.

CodeSweetly ads

Express Your Love for Coding!

Explore CodeSweetly's Shop for an array of stylish products to enhance your coding experience.
Shop now

Domain Name

A domain name (second-level domain) is your website’s name. It is the name you buy from a domain registrar like Namecheap and Shopify.

In other words, a domain name is a text that comes after the subdomain.

So, for instance, in www.codesweetly.com, codesweetly is the domain name.

And right after the domain name comes the third-level domain—which is also called the subdomain.

Subdomain

A subdomain (third-level domain) is a subset of a specific website. It allows you to categorize your website into one or more sections.

Although most people use www as the main section of their website, you are technically free to categorize your domain as you wish.

So, for instance, suppose you intend to group codesweetly.com into five categories:

  • The main section
  • The news section
  • An online store
  • The forum segment
  • The projects area

In that case, the site’s five sections could look like so:

  • The main section: www.codesweetly.com
  • The news section: news.codesweetly.com
  • The online store: shop.codesweetly.com
  • The forum section: forum.codesweetly.com
  • The projects section: projects.codesweetly.com

Keep in mind that the subdomains in the five sections above are: www, news, shop, forum, and projects.

Now, suppose your domain does not contain a subdomain. In that case, the domain would be called a base, apex, bare, root apex, naked, or zone apex domain.

So, for instance, codesweetly.com is CodeSweetly’s apex domain.

However, we’ve configured the bare domain to redirect to the www subdomain.

Therefore, if you enter codesweetly.com in your browser, the computer will redirect you to www.codesweetly.com.