Windows OS

How to Do a DNS Lookup in Windows?

DNS is a tiered distributed name mechanism for systems, facilities, or any commodity linked to the net or an isolated network. It includes diverse pieces of data to domain names allocated to every one of the participants. Most notably, it converts domain names that are important to people into the numeric IP addresses required to update computer devices and applications throughout the globe.

The Domain Name System is indeed an important part of the Web’s operation since it provides a globally distributed keyword-based redirecting facility. NSLOOKUP is a command-line utility included with Microsoft Windows. In this guide, we will learn about the DNS lookup in the windows system. So, let’s get started.

Search the command prompt from the search bar of your windows desktop. The command prompt will be poped-up. Click on it to launch it. Now the command prompt has been opened, we can start doing a DNS lookup on it. First of all, we need to look at the current settings of our DNS. For that purpose, we have to just use the below ipconfig command followed by the keyword “displaydns” with a backslash sign in our shell and press the Enter key. You will see a long record of DNS settings that are currently held by our system.

ipconfig /displaydns

Between these DNS settings, we have an entry of and its information as shown in the below image. Remember the given data of Google provided in the image.

These settings have also a record about and its information as presented below. Make sure to remember the provided information on Youtube as well.

As we have a lot of DNS settings in our system, let’s just quickly delete all of them at once. For this reason, use the ipconfig command with the keyword “flushdns” along with the backslash sign and tap the Enter button. You will see that it will flush all the previous entries from the cache as the success message is presenting in the image below.

ipconfig /flushdns

Check the DNS settings once again using the previous displaydns command as below. You can see, this time it displays nothing because all the entries are flushed out.

Ipconfig /displaydns

As all the DNS data has been flushed, we need to do the DNS lookup now. So, we will ping the Google address first by using the below instruction followed by the Enter key in the cmd shell.


Let’s ping the Youtube address using the below query of ping and hit the Enter key from the keyboard.


Now, let’s have a look at the DNS settings once again by utilizing the displaydns command in the command prompt as below and tap Enter. You can see it shows the Google and Youtube entries in the settings while all the other settings are flushed out. You will see that the settings of Google mentioned below are different from the information provided before the flush of DNS.

The IP address, as well as other details, must be included in DNS data for and A TTL value typically differs from TTL inside an IP packet, which seems to be another entry inside the DNS buffer. The DNS server that manages the Youtube and Google record sends this DNS TTL value. It is calculated in seconds and also instructs the DNS client about how long to buffer the DNS data to avoid clients lingering on to DNS information which IP addresses ought to update.

Ipconfig /displaydns

Youtube entry is as below. The information regarding Youtube given below is very different from the previous information before the flush action taken place.

Now, it’s time for us to open our system’s host file. For that purpose, search “Notepad” from the search bar of your windows desktop. Right-click on it to open it via the “Run as Administrator” option. Tap on “Run as Administrator”. As the notepad has been opened, click on the “File” menu and select the option of “Open”. It will open a dialogue box on your screen.

Navigate towards the C:\\Windows\System32\Drivers\etc. Select the option of “All Files” from the dialogue box to see all the files residing in the “Etc” folder. You will get a list of some files. Double-click on the “hosts” file to open it in a notepad.


Now, the “hosts” file has been opened in the notepad as presented below with some service records.

Add the below-shown IP address with a name at the bottom of the notepad file. Save your file and quit it quickly.

Let’s check the DNS settings once again to look up the new entry in the host file using the ipconfig command of displaydns, and tap on Enter. The output image is showing the new entry “university” in the cache.

Ipconfig /displaydns

Ping the new entry with our server using the below query and tap Enter.

ping university

Let’s flush out the records of DNS settings once again by ipconfig command followed by the Enter key.

Ipconfig /flushdns

Now, check the DNS settings one more time by displaydns keyword in the ipconfig command. Try the below query followed by the Enter button. You can see it doesn’t delete the record of entry “university” even after the flush of DNS settings. This is because we have added this IP address into the host file as host file IP addresses cannot be removed.

Ipconfig /displaydns

Add the below path of a site with the “nslookup” keyword in the command prompt. The title and Source IP of the DNS server, as well as the identity and IP of, are shown. You can search for a host’s IP without even connecting with it by using Nslookup.


Let’s use the nslookup command in the command prompt and tap Enter. We would then be in the interactive environment of Nslookup. An arrowhead prompting should appear.


Enter the below site path in the interactive mode and hit the Enter button. You can see it returns many IP addresses.

Retype the same site path and press Enter. This time it returns the different IP addresses for the same site with a different pattern. This implies we can access the site by using many different IP addresses.

You can use the below command to check how many of the “A” records are there in your DNS.

nslookup example

If you want to check how many of the “ns” records are there in your DNS system, then try out the below query in the command prompt. The output shows a 1 “ns” record.

nslookup –type=ns example

If a user wants to check the start of authority in its system, they can do so by the following below query in the command prompt.

nslookup –type=soa example

If we want to check the mail servers’ “MX” records in our DNS system, we can do so by utilizing the below query.

nslookup –query=mx example


In this guide article, we have performed every step to do DNS lookup in Windows 10 system. All the instructions are perfectly functional on all previous versions of Windows.

About the author

Aqsa Yasin

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.