Each computer on the Internet is assigned a unique address, called an IP address. A typical IP address looks like this: 199.123.456.7
It is very difficult to keep in mind the IP addresses of all the websites we visit daily. Words are easier to remember than strings of numbers. This is where domain names come into the picture. When you visit a website, all you need to know is its URL. Computers remember numbers, and DNS helps us convert the URL into an IP address that the computer can understand.
When you type in domain.com into your browser, the browser first needs to get the IP address of www.domain.com. The browser contacts a DNS server to query the location of the server where the webpages are stored. Think of it as a directory service of IP address.
The classic phonebook directory analogy, you need to find the company “Joe’s Bookstore”, you look in the directory and see that it is located on 123 Main Street. Then you go to the address to visit the store.