Nslookup Command – DNS Query Tool for Windows, Linux, and macOS

Nslookup is a DNS query tool similar to the dig command, which administrators use to query DNS Servers for different record types.

The good thing about nslookup is that it is available on Windows, Linux, and macOS right out of the box.

In its most basic form, we use nslookup to find the IP Address of a domain:

nslookup example.com

If you run the nslookup command like that without any argument, it will return the IPv4 address (A record) and IPv6 address (AAAA record) for the domain name you enter.

You will see something similar to the following:

nslookup command on windows

The first two lines provide information about the DNS server that has provided the answer. You will find the A record and AAAA record (if available) under the answer section.

Nslookup by default queries the DNS Server your local computer is currently configured to use. However, we can specify a different DNS server as follows:

nslookup example.com 8.8.8.8

In the above example, we are asking nslookup to perform the DNS query using the DNS server located at 8.8.8.8.

nslookup specify dns server
Specify the DNS Server.

If the command marks the response as non-authoritative, that means the server that has provided the response is not the DNS server responsible for the domain.

To find nameservers of a domain, run the nslookup command as follows:

nslookup -type=NS example.com

We use the -type argument to query different record types. For example, to find out the mail server of a domain, run the nslookup command as follows:

nslookup -type=MX example.com

The following table lists the different record types you can query with the -type option.

Record typeDescription
AIPv4 address of a domain name.
AAAAIPv6 address.
CNAMECanonical name.
NSName Servers for the domain.
MXThe mail exchanger (MX) record is used to specify the location of the mail servers of a domain.
SOAStart of Authority.
SRVService record.
PTRReverse lookup. Find the domain name of an IP Address.
TXTText record.
Using nslookup command to check DNS records

On Microsoft Windows, the nslookup command is available in both CMD and PowerShell.