Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install the dig Command on Windows

dig is not part of Windows. Add it with Cygwin or use it in a WSL / Git Bash environment.

Windows Hosting2 min read7 screenshots

About dig

dig (Domain Information Groper) is a command-line tool that queries DNS servers. It is built into Linux and macOS but not into Windows. On Windows you can use nslookup, or install dig as follows.

Option 1: Install dig with Cygwin

Step 1. Download the Cygwin setup file from the Cygwin website.

The Cygwin download page

Step 2. Run the setup (setup-x86_64.exe).

The Cygwin setup

Step 3. Choose Install from Internet.

Choosing the installation type

Step 4. Choose the root folder, such as C:\cygwin64, and then the folder for the downloaded packages and a download site.

Selecting the root directory

Step 5. On the package screen, search for bind-utils. Click on Skip next to it until it shows a version number. This package contains dig. Click Next and finish the install.

Selecting the bind-utils package

Step 6. Open the Cygwin terminal and test:

dig google.com
dig in the Cygwin terminal

Option 2: Use a Linux shell (WSL or Git Bash)

If you use the Windows Subsystem for Linux (WSL), install dig inside the Linux distribution:

sudo apt install dnsutils
Installing dnsutils in the Linux shell

Then:

dig bing.com

(Git Bash for Windows does not include a package manager, so apt-get does not work there. Use WSL or Cygwin.)

Examples of dig

Record types

TypeMeaning
AIPv4 address
AAAAIPv6 address
CNAMECanonical name (alias)
MXMail exchanger
NSName server
PTRReverse lookup
TXTText record
SRVService record
dig example.com A

Ask a certain DNS server

dig example.com @8.8.8.8

Recursion

  • +norecurse prevents recursive queries.
  • +recurse forces them (it is the default).
dig example.com +recurse

Trace the path of the query

dig example.com +trace

Short answer

dig +short example.com

Retries and time-out

dig example.com +retry=3 +time=2

Without installing anything

Use nslookup example.com in Command Prompt, or Resolve-DnsName example.com in PowerShell.

Quick recap

  • Install dig through Cygwin (bind-utils) or WSL (dnsutils).
  • dig example.com @8.8.8.8 asks a specific server.
  • nslookup and Resolve-DnsName are built into Windows.