DNS or Domain Name System, converts hostname to computer-friendly IP address.
Each device connected to the internet has a unique IP address which other machines use to find the device.
IP address expressed as string of numbers for eg: 192.158.1.38
You don't need to remember the IP address of a domain name. The DNS will look up the IP address based on the URL you type in.
Now, let's see how does the DNS actually works
Step 1: Client Requests Domain
When you type www.google.com in your browser(client) the computer checks the two layers of cache the browser and operating system cache. It will check if we have made this request earlier. If yes, then it returns the home page of google.com . If not, then it is directed to the DNS Resolver.
Step 2: DNS Resolver
DNS Resolver is hosted by ISP i.e Internet Service Provider.
It will check it's Resolver cache , if the request was made earlier by anyone , lets assume that the request wasn't made before. Then it will make a request to the Root Nameserver.
Step 3 : Root Nameserver
Root Nameserver are collective of 13 different server distributed globally and managed by large corporates. It reaches out to one of the 13 servers. It will then ask the server for the IP address for google.com. The server will say that I don't the IP address (assuming no cache) Text but I know someone who knows someone that might know the IP address. SO, it responds with the IP address to DNS Resolver of .com TLD
Step 4: TLD Nameserver
TLD Nameserver is a logical set of servers distributed around global which corresponds to extensions such as .org .com .edu . DNS Resolver gets the IP address of TLD and propogates to TLD Nameserver, .com responds with IP address of ANS(Authoritative Name Server) to DNS Resolver.
Step 5: ANS -Authoritative Name Server
DNS Resolver asks ANS to find the IP address of ggogle.com. ANS then scans zone files and domain names and returns the IP address back to the DNS Resolver.
Now the DNS Resolver will tell the IP address to the computer and then your computer can now retrieve the google.com page.