How to Install Dig on Windows

December 8, 2021


The dig command (Domain Information Groper) is a popular Linux utility used for performing DNS lookups. It provides more flexibility than Windows NSLookup but, unfortunately, it isn't available in Windows 10 by default.

One option for using dig on Windows is to install BIND. This tool lets you use the dig command in the Windows command prompt.

In this tutorial, we will show you how to install BIND and edit Windows environment variables to enable dig. We also provide examples of using the dig command to perform a DNS lookup.

How to install dig on Windows


  • A system running Windows 10.
  • An account with administrator privileges.
  • Access to the command prompt.

Download BIND

1. Visit the BIND download page using your preferred web browser.

2. Click the Download button to select the latest stable version of BIND. In this tutorial, we are using version 9.16.23.

Select the version of BIND you want to install

3. Click the link to download the BIND installation zip file.

Download BIND using the link

Install BIND

1. Extract the BIND installation file.

2. Open the BINDInstall.exe file as an administrator to start the installation wizard.

3. In the Target Directory field, set the path to where you want to install BIND on your system.

Select where you want to install BIND

4. Set a name for your service account in the Service Account Name field.

Set a name for your service account

5. Set and confirm a password for the service account.

Set up a password for your service account

6. In the Options section, check the Tools Only box.

Select the Tools Only option in the Options section

7. Click the Install button to start the installation process.

Click the Install button to start the installation process

Note: Installing BIND may automatically install Microsoft Visual C++ Redistributable. In this case, click the Install button to confirm.

8. Once the installation is complete, click OK to confirm and Exit to close the installer.

Create Windows Path Variable

1. Open the Start menu and search for "environment variables".

2. Select the Edit the system environment variables option.

Open the Edit the system environment variables option in the Start menu

3. In the System Properties window, under the Advanced tab, click the Environment Variables… button.

Open the environment variables editor

4. Under System variables, scroll down and select Path, then click the Edit button.

Select and edit the Path system variable

5. In the variable editing window, click New and enter the path to the BIND installation folder (the default path is C:\Program Files\ISC BIND 9\bin).

6. Click OK to confirm the edits to the Path variable.

Add the new value for the Path variable and click OK to confirm

7. Click OK to confirm the changes and exit the Environment Variables window.

Using dig Command in Windows

After installing BIND, open the Windows command prompt to start using the dig command. The dig command uses the following syntax:

dig [hostname] [options]

Using dig Without Command Options

Using the dig command without any options returns DNS data on the provided hostname. For instance:

The default output for the dig command

The default dig command output contains the following sections:

  • HEADER: Basic information about the request.
  • OPT PSEUDOSECTION: Advanced information about the request.
  • QUESTION SECTION: The summary of the query made to the DNS. In this example, it is the first available A record for the hostname provided.
  • ANSWER SECTION: The answer to the query made to the DNS. In this example, it is the IP address for the first A record.

The dig command also allows you to specify the type of record you want to query by using:

dig [hostname] [record type]

Note: The DNS record types you can query include A, AAAA, MX (Mail Exchanger), NS, and TXT. Learn more in our guide to DNS record types.

List All Records for a Hostname

To return all records for the provided hostname, use the any option:

dig [hostname] any

Get a Hostname's IP Address

Using the +short option with the dig command provides a shortened output (usually just the IP address):

dig [hostname] +short

For example:

dig +short
Dig command short output

Check DNS Resolution

Adding the +trace option resolves the query starting from the root nameserver and working its way down, reporting the results from each step:

dig [hostname] +trace

For instance:

dig +trace
Using the dig command with the trace option

Query a Nameserver Directly

The dig command also allows you to query a nameserver directly:

dig @[nameserver address] [hostname]

Do a Reverse DNS Lookup

Another use for the dig command is performing reverse DNS lookups:

dig -X [IP address]

Note: Learn more about reverse DNS lookups in our guide to reverse DNS.


After reading this tutorial, you should be able to use the dig command in the command prompt through BIND.

If you want to use dig with a Linux system instead, check out our guide to installing dig on CentOS 7 and 8.

Was this article helpful?
Aleksandar Kovačević
With a background in both design and writing, Aleksandar Kovacevic aims to bring a fresh perspective to writing for IT, making complicated concepts easy to understand and approach.
Next you should read
Troubleshooting DNS Issues {nslookup, dig, host & More}
November 17, 2021

DNS issues can be troublesome. This tutorial offers some useful tips and troubleshooting methods to help you pinpoint and resolve DNS problems.
Read more
How to Use Linux dig Command (DNS Lookup)
May 23, 2024

dig (Domain Information Groper) command is a tool for querying DNS name servers. It is a helpful command for diagnosing DNS problems but is also used to display DNS information.
Read more
How to set DNS Nameserver on Ubuntu 20.04
May 18, 2021

The Domain Name System (DNS) translates text-based domain names to numeric IP addresses. Most networks are configured to work with DNS servers provided by the ISP. This tutorial shows you how to change DNS addresses in Ubuntu.
Read more
DNS Best Practices for Security and Performance
November 11, 2019

DNS management is a significant hurdle in enterprise environments. DNS infrastructure needs to be organized properly to avoid security and performance issues. By following DNS best practices, most potential problems can be evaded.
Read more