As per Wikipedia “The Domain Name System is a hierarchical and decentralized naming system for computers, services, or other resources connected to the Internet or a private network.”
Let me give you a brief on this how it works.
Let takes an example domain affordablehosting.space for understanding.
When you type affordablehosting.space on your browser’s address bar, the browser sends to DNS resolver to get the IP address of affordablehosting.space, once the resolver resolves the IP address, your computer will be able to communicate to affordablehosting.space server IP and the website it rendered based on there sever where it has been targeted. To give you in sort, take an example of a contact book, we search by name, and we dial the number. It’s just similar how we deal with contact book for our numbers, and similar DNS resolver acts as a contact book for web address IP.
Why we need domain name instead of IP.
It’s hard for a human to remember all IP of the website as humans are easier to remember words than numbers, apart from this, when comes to small business, it’s hard to afford dedicated IP for every single site, so in the concepts of virtual hosting.
How did resolver know the IP of a web address?
When you type affordablehosting.space on your browser’s address bar, it sends to the resolver, a DNS resolver is a storage server, which stores web address and IP corresponding to it. When the resolver cannot find the IP, might be due to new domains, the resolver then sends to next level of authority which is Root DNS, these roots sever are parent server of DNS, as DNS can be your ISP DNS or any free or premium DNS you own. For All DNS root, DNS is the at most. So when the root server receives the request for IP address for affordablehosting.space, the root server if finds the IP it sends to respective DNS resolver and these respective DNS gets updated. If root server does not know the IP address, then root will contact the highest authority server call TLD servers, TLD like .com, .net likewise. Each TLD has its own server with exact current IP and responsible for knowing everything about that particular TLD. Now the TDL server sends back to root and root to respective DNS path, and all path gets updated with the latest request. So when a request for affordablehosting.space comes to DNS resolver, the same know the IP and sent communication request between your browser and website affordablehosting.space.