Knowledge Base

Troubleshooting DNS with dig and nslookup

In this article, we will explain how to use the dig and nslookup tools to test your DNS settings. These tools are specific depending on the operating system you are using. Specifically, if you are running MacOS or Linux, you’ll use dig. If you are on a Windows device you will make use of nslookup.

Using these tools, you will be able to determine what the IP address associated with a domain name is, obtain information such as the mail server settings for a domain, and so much more.

Troubleshooting DNS with Command-line tools

There are two primary command-line based tools for troubleshooting DNS issues and those are specific to operating systems. Dig (on MacOS and Linux) and nslookup (for Microsoft Windows users).

While there are web tools you can use to perform the same actions, command-line is often faster and is a tool built into your own system. To get started, follow the guides below specific to your operating system.

Using nslookup on Windows devices

Dig does not come native to Microsoft Windows but thankfully, there is another just as powerful system called nslookup. To get started with nslookup, follow the steps outlined below:

  • Open a new command line window by clicking on the Start button and searching for command line (or cmd).
  • In the command line interface, type the following command replacing with the domain name you would like to test: nslookup
  • You should now see an output for your nslookup command. In our case we can see resolves to the IP address:

By default nslookup will lookup the A record of a domain name. You can change this by entering the interactive mode of nslookup. For example, to view an MX record on the domain type nslookup in the command line.

At the > in the command prompt type in the following commands:
set type=MX

And that is it! You have successfully ran an nslookup on your Windows device.

Using dig on MacOS / Linux devices

Dig is the MacOS / Linux alternative to Window’s nslookup. To get started with dig follow the instructions below:

  • Open a new Terminal window. This process can differ depending on your specific operating system though they should be fairly similar to the steps below:
    • MacOS: Click Applications -> Utilities -> Terminal
  • In your terminal window, type in the following command replacing with your own domain: dig
  • You should see the output of the dig command in your terminal like below:
hostdash@HostDash-MacBook ~ % dig

; <<>> DiG 9.10.6 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34932
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 512
;			IN	A


;; Query time: 15 msec
;; WHEN: Thu Jun 17 20:18:31 EEST 2021
;; MSG SIZE rcvd: 56

Dig uses a question and answer form in the output. In our case, we can see the question is to gather the A record for and the answer shows’s A record being

By default dig will lookup the A record for a domain name. If you would like to output a different DNS record you can add it to the end of the command.

For example, to find the MX record for you would want to run the command: dig MX

Browser alternatives to testing DNS with dig and nslookup

It is worth mentioning there are alternative solutions (specifically browser based networking tools) if you are not familiar with command line. These free online services typically cater to specific pieces of information.

For example, if your goal is to determine if DNS propagation has completed, you can use the free online service called and enter your websites domain name. This specific service will then output the IP addresses associated with your domain name from various DNS servers located across the globe.

If you are after a more in-depth overview on a domains DNS, you can use the online dig interface located at To use the dig web interface to determine the IP address associated with a domain name follow the steps below:

  • Using your preferred web browser, navigate to dig web interface website
  • In the large text box called Hostnames or IP Addresses enter the domain name of the website you would like to test
  • In the Type drop down menu list, select the DNS record type A

You can test multiple websites at once, as well as different DNS record types though for this article, we will focus on a single domain name and the A DNS record. For more information on DNS record types click here.

  • Under Options, select the Show command checkbox
  • If you wish to test from a specific DNS server (such as OpenDNS or Google DNS) select it from the Nameservers dropdown menu. Alternatively, and for simplicity, you can leave it set to the default option.
  • Once ready, click on the dig button to start the process. Once you click the button, you will be presented with the results from the dig as well as the full command used to initiate the process.

Did you find this article helpful?

If you found this article helpful then you will love our support! Get blazing fast Shared Hosting and experience the HostDash difference today!

Check out our Shared Hosting plans today.

Have a Question?
We're here to help!

Email Us

Send us an email with your questions and we'll get back to you momentarily.

Send us an Email
Live Chat

Chat live with a member of our sales team to discuss your next project.

Chat with Sales
Submit a Ticket

Chat live with a member of our sales team to discuss your next project.

Submit a ticket