• What is the nslookup command?
  • How nslookup works
  • Common DNS issues you can diagnose with nslookup
  • Nslookup vs. other network diagnostic tools
  • FAQ: Common questions about nslookup
  • What is the nslookup command?
  • How nslookup works
  • Common DNS issues you can diagnose with nslookup
  • Nslookup vs. other network diagnostic tools
  • FAQ: Common questions about nslookup

What does nslookup do? A practical guide

Featured 03.03.2026 8 mins
Sam Boyd
Written by Sam Boyd
Ata Hakçıl
Reviewed by Ata Hakçıl
Ana Jovanovic
Edited by Ana Jovanovic
what-is-nslookup

Nslookup is a network troubleshooting utility that queries Domain Name System (DNS) servers to retrieve information about domain names and IP addresses.

This guide explains how the nslookup command works, what information it returns, and how to use it for DNS troubleshooting.

What is the nslookup command?

The nslookup command (short for “nameserver lookup”) is a command-line DNS query tool available on Windows, macOS, and Linux. It sends queries to DNS servers to get details about the mapping between domain names and IP addresses.

As well as translating domain names into IP addresses, it can perform reverse lookups to find domain names from IP addresses and examine different types of DNS records. It can be used to verify that DNS resolution is working correctly and to troubleshoot connectivity problems.

How nslookup works

When you execute an nslookup command, the tool sends a query to a DNS server, which processes it and returns the requested information. The nslookup utility displays the results on your terminal. You can query various types of information or records, with the most common highlighted below.

  • Address (A): Points a hostname to an IPv4 address. Also used for operating a DNS-based Blackhole List (DNSBL), which is a list of known spammer domains.Looking up Address record using nslookup.
  • Quad-A (AAAA): An alternative to the A record that points a hostname to an IPv6 address. Like A records, these can also be used to help manage DNSBL entries.Looking up type AAAA record using nslookup.
  • Canonical Name (CNAME): Maps an alias domain name (like blog.example.com) to its root domain name (example.com). This helps in confirming whether subdomains are properly configured.Looking up Canonical NAME record using nslookup.
  • Mail Exchange (MX): Points to the mail servers responsible for email on behalf of a domain. MX records ensure mail-sending servers are able to deliver emails addressed to your domain.Looking up Mail Exchange record using nslookup.
  • Nameserver (NS): Identifies authoritative name servers that carry a domain’s records. Domains often rely on multiple nameservers to increase their reliability.Looking up Name Server record using nslookup.
  • Pointer (PTR): Performs a reverse DNS lookup, pointing an IP address back to a domain name. Used by logging systems that record only IP addresses or by anti-spam filters that reverse-check email domains to confirm the associated IP address belongs to a legitimate mail server.Looking up Pointer record using nslookup.
  • Start of Authority (SoA): Provides administrative information about a domain, such as its primary nameserver and the mail address of the administrator. SoA records are the first records transferred when DNS data moves from one nameserver to another.Looking up State of Authority record using nslookup.
  • Text (TXT): Returns human-readable TXT records that domain administrators manually enter into their domain’s record. Useful in helping email servers determine if messages are from trusted sources.Looking up Text record using nslookup.

Using nslookup on different operating systems

Below you’ll find instructions on how to use nslookup on Windows, Linux, and macOS.

Using nslookup on Windows

  1. Press the Windows + R keys to open the Run command window.Opening Run command window on Windows
  2. Type cmd in the Run window and press Enter or click OK.Opening the Command Prompt through the Run command window on Windows.
  3. Type nslookup and press Enter or add parameters, such as -type=A, to run a specific query.Using the nslookup command on Windows.

Using nslookup on Linux

  1. Right-click the desktop on your Linux device and click Open in Terminal.Opening the Terminal on Linux.
  2. Enter nslookup followed by any required parameters (such as -type=A) to run a query.Using the nslookup command on Linux.

Using nslookup on macOS

  1. Open Finder on your macOS device, access the Applications menu from the left-hand side, and open Utilities.Accessing the Utilities menu on macOS.
  2. Double-click Terminal in the Utilities folder to open it.Opening the Terminal through Utilities on macOS.
  3. Type nslookup followed by the domain and any parameters you need to run a query.Entering nslookup's interactive mode.

Using nslookup in interactive mode

Nslookup has two modes: interactive and non-interactive.

Non-interactive mode runs when a complete query is entered, as in the examples above.

Interactive mode starts when only nslookup is entered and Enter is pressed. “>” appears on the next line to indicate that interactive mode is active.Entering nslookup's interactive mode.

When you’re in interactive mode, you can execute multiple queries in succession without needing to type the nslookup command repeatedly. The example below runs a lookup on google.com and expressvpn.com in succession by simply entering the domain names.Looking up multiple domains in succession while using nslookup in interactive mode.

If you want to use a specific query type for all subsequent queries, you can specify this using the set and querytype parameters. The example below uses set querytype=mx to ensure all subsequent queries look up the responsible mail servers of a domain. The query type parameter isn’t case sensitive, and you can use any of the aforementioned record types in place of mx. up the responsible mail servers of a domain. The query type parameter isn’t case sensitive, and you can us

While in interactive mode, you can also type the help command to view a detailed list of nslookup commands and other useful information.

Authoritative vs non-authoritative records

Nslookup queries sometimes return a result indicating a “Non-authoritative answer,” meaning the information was retrieved from the local DNS server cache rather than from the domain’s authoritative server.Receiving a non-authoritative answer from nslookup query.

Since this record is from the local DNS cache, it’s possible that it might be outdated. In order to get an up-to-date record, the authoritative server of a domain has to be queried. You can get a domain’s authoritative server using the SoA query type. It’s listed next to the primary name server in the query’s output.Using nslookup Start of Authority query to check the authoritative nameserver of a domain.

Once you have the authoritative server of a certain domain, you can add it at the end of your command to query it directly and get an up-to-date record.Querying Facebook's authoritative server to get an up-to-date DNS record.

Common DNS issues you can diagnose with nslookup

The nslookup command can help diagnose various DNS-related problems affecting network connectivity and web access.

Identifying name resolution problems

If a website you manage won’t load, checking whether the domain name resolves is a key early step. Run “nslookup domain.com” to see if the DNS server returns an IP address. If you receive an error like “Non-existent domain,” the domain name may not exist or may not be properly configured.

Failed DNS resolutions can also be due to misconfigured nameserver records. Nslookup can help verify if your domain is delegated to the correct DNS servers through an NS query like “nslookup -type=ns domain.com,” showing which nameservers are currently published for the domain. If the listed nameservers are incorrect, missing, or don’t match what you configured at your domain registrar, this indicates the nameserver settings aren’t configured properly at your registrar and need to be resolved.

You can also use nslookup to check if any updates to your domain’s DNS records have successfully propagated across the internet. To do this, query multiple public DNS servers like Google's 8.8.8.8 or Cloudflare's 1.1.1.1 by adding them to the end of your query. If they return different results, your domain’s DNS records haven't fully propagated yet.

Common nslookup errors and what they mean

The following are some common errors seen when using nslookup:

  • Timed out: The server failed to respond to a request within a set amount of time and retries. The amount of time and number of retries can be adjusted using “nslookup set timeout=number” and “nslookup set retry=number” parameters.
  • No records: “*** Can't find domain: No answer” error means that the DNS server doesn’t have records for the chosen query type for a particular domain.
  • Nonexistent domain: The specified domain name does not exist.
  • Connection refused: The DNS server refused to respond to the request.
  • Server failure: The DNS server failed to return a valid answer due to inconsistencies in its own records.
  • Format error: The request wasn’t in the proper format.

Nslookup vs. other network diagnostic tools

Apart from nslookup, there are several querying utilities, each with its own strengths and use cases.

Nslookup vs. dig

The dig (Domain Information Groper) command is often considered more powerful than nslookup for advanced DNS diagnostics.

Dig supports more query types and provides a more detailed output by default, including query time, message size, and every other piece of information in a DNS response, making it good for a thorough investigation. Nslookup provides a simpler and more concise output that's good for basic troubleshooting.

Nslookup vs. ping

Ping is a connectivity testing tool that sends Internet Control Message Protocol (ICMP) echo requests to measure latency (the time it takes for a data packet to travel from your device to a server and back again, measured in milliseconds) and check if a host is reachable. It uses the operating system's standard name resolution, which includes checking the hosts file (a local system file that manually maps domain names to IP addresses before a DNS query is sent to external servers), local DNS cache, and DNS servers.

In contrast, nslookup is a DNS-specific query tool that sends queries directly to DNS servers. It doesn't test connectivity or measure latency but focuses solely on DNS information.

When nslookup is the right tool to use

Nslookup is best used for diagnosing basic DNS resolution problems rather than general network issues. It verifies domain-to-IP resolution, checks DNS propagation, and examines MX, NS, or TXT records.

FAQ: Common questions about nslookup


What is the main purpose of the nslookup command?

The main purpose of nslookup is to query Domain Name System (DNS) servers to obtain information about domain names and IP addresses. This helps troubleshoot DNS resolution issues and verify DNS record configuration.

Where does nslookup get its information from?

Nslookup fetches information from Domain Name System (DNS) servers. By default, it queries your system's configured DNS resolver, but you can specify any DNS server. The tool queries these servers directly and displays their responses.

What DNS records can nslookup query?

Nslookup can query various Domain Name System (DNS) record types, including A (IPv4 addresses), AAAA (IPv6 addresses), MX (mail servers), NS (nameservers), CNAME (canonical names), TXT (text records), SOA (start of authority), and PTR (reverse lookups).

Can nslookup work without an internet connection?

Nslookup can work without internet access if you're querying local Domain Name System (DNS) servers or hosts within your local network. However, resolving public internet domains requires connectivity to external DNS servers and the internet.

Is nslookup still useful today?

Yes. Even though tools like dig offer more features, nslookup's availability across all major operating systems and simple interface make it valuable for quick Domain Name System (DNS) troubleshooting and basic queries.

Take the first step to protect yourself online. Try ExpressVPN risk-free.

Get ExpressVPN
Content Promo ExpressVPN for Teams
Sam Boyd

Sam Boyd

Sam is a Senior Editor at the ExpressVPN blog, combining years of experience in online privacy, safety, and cybersecurity with a passion for all things tech. He enjoys helping readers make sense of complex topics in a straightforward way. Outside of work, he’s usually watching the latest sci-fi shows, deep into a video game, or trying to keep up with his mischievous cat.

ExpressVPN is proudly supporting

Get Started