TechBuzzPro

nslookup on Windows: Step-by-Step Guide

· 6 min read · Windows & PC

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

nslookup is a built-in Windows command-line tool that queries DNS (Domain Name System) servers to translate domain names into IP addresses and vice versa. It helps you diagnose DNS problems, check which server is responding, and verify that a domain resolves correctly. You do not need to install anything—it ships with Windows—but you do need a Command Prompt or PowerShell window and an internet connection (or access to a DNS server).

What You'll Need

  • A Windows PC (Windows 7 or later; the steps here use Windows 10/11).
  • Access to Command Prompt or PowerShell (no admin rights required for basic queries).
  • A working network connection, or the IP address of a DNS server you want to query.
  • The domain name or IP address you want to look up.

Step-by-Step

  1. Open Command Prompt or PowerShell. Press the Windows key, type cmd or powershell, and press Enter. You can also press Win+R, type cmd, and press Enter. The steps work the same in both shells; menu labels and prompts may differ slightly by Windows version.
  2. Run a basic lookup. Type nslookup example.com and press Enter. Replace example.com with the domain you want to check. The output shows the DNS server that answered and the IP address(es) for the domain.
  3. Read the output. The first two lines show the server and its address (the DNS resolver your PC is using). The “Non-authoritative answer” section lists the resolved IP addresses. “Non-authoritative” means the answer came from a cache, not directly from the domain’s own DNS servers—this is normal.
  4. Query a specific DNS server. To test a different resolver (for example, Google Public DNS at 8.8.8.8), type nslookup example.com 8.8.8.8. This sends the query directly to that server, which helps isolate whether your default DNS is the problem.
  5. Look up an IP address (reverse lookup). Type nslookup 8.8.8.8 to see which hostname that IP maps to. Not every IP has a reverse record; a “can’t find” message is common and not necessarily an error.
  6. Enter interactive mode for multiple queries. Type nslookup alone and press Enter. You will see a > prompt. Now you can type domain names one per line without retyping nslookup each time. Type exit to leave.
  7. Change the default server in interactive mode. At the > prompt, type server 1.1.1.1 (or another DNS server IP) and press Enter. Subsequent queries use that server. Type server alone to see the current default.
  8. Query specific record types. In interactive mode, type set type=mx to look up mail exchanger records, then enter a domain like example.com. Other common types: set type=ns (name servers), set type=txt (text records), set type=a (IPv4 address), set type=aaaa (IPv6 address). Type set type=a to return to the default. These record types are standard DNS record types and are supported by nslookup.
  9. Turn off recursion (advanced). In interactive mode, set norecurse tells the server not to chase down the answer from other servers. This is useful for checking exactly what a specific server knows. Use set recurse to turn it back on. Most users do not need this.
  10. Exit interactive mode. Type exit and press Enter, or close the window.

Common Mistakes

  • Forgetting the domain. Running nslookup with no arguments opens interactive mode; if you expected a single answer, you may be confused by the > prompt. Type exit and rerun with the domain.
  • Mistaking “Non-authoritative answer” for an error. It is normal and simply means the answer came from a cache.
  • Assuming a failed lookup means the domain is down. The domain may exist but your DNS server may be unreachable or misconfigured. Try a public resolver like 8.8.8.8 to compare.
  • Typing http:// or a path. nslookup expects a hostname only (e.g., example.com), not a full URL.
  • Using the wrong record type. If you query set type=mx and get no answer, the domain may simply have no MX records. Switch back to set type=a to check basic resolution.
  • Expecting nslookup to flush the DNS cache. It does not. Use ipconfig /flushdns in Command Prompt (run as administrator) to clear the local cache.

Tips

  • Use nslookup with a specific server to compare results from different DNS providers—useful when a site loads for others but not for you.
  • In interactive mode, set debug shows the full DNS response, including flags and additional records. It is verbose but helpful for deep troubleshooting. Turn it off with set nodebug.
  • Press the Up arrow key to recall previous commands in both Command Prompt and PowerShell.
  • If you need to copy output, right-click the window title bar, choose Edit > Mark, select the text, and press Enter to copy.
  • nslookup is available in Windows Recovery Environment and Safe Mode with Networking, which can help when the normal desktop is misbehaving.

Troubleshooting

  • “DNS request timed out” or “Server failed”: The DNS server you are querying is not responding. Check your network connection, try a public resolver (8.8.8.8 or 1.1.1.1), and verify that your firewall is not blocking DNS (UDP port 53).
  • “Can’t find example.com: Non-existent domain”: The domain may be misspelled, or the DNS server has no record. Double-check the spelling and try another server.
  • “Default Server: Unknown”: Your PC’s configured DNS server does not have a reverse record. This is cosmetic; queries still work. If queries fail, check your network adapter’s DNS settings.
  • nslookup not recognized: Ensure you are in Command Prompt or PowerShell, not a different shell. If the command is missing, the system PATH may be altered; run where nslookup to locate it (typically C:\Windows\System32\nslookup.exe).
  • Inconsistent results: DNS caching can cause differences. Flush the local cache with ipconfig /flushdns (run Command Prompt as administrator) and query again.
  • Corporate network blocks external DNS: Many workplaces force all DNS through internal servers. Queries to 8.8.8.8 may be blocked; use the internal server address provided by IT.

Frequently Asked Questions

What is nslookup used for?

It queries DNS servers to resolve domain names to IP addresses, check mail servers, and diagnose DNS configuration issues.

Is nslookup available on all Windows versions?

Yes, it has been included with Windows for many versions, including Windows 10 and 11. It is also available in Windows Server.

How do I look up a specific record type like MX?

Run nslookup to enter interactive mode, type set type=mx, then enter the domain. Use set type=a to return to the default.

Why do I get “Non-authoritative answer”?

That means the response came from a DNS cache rather than the domain’s authoritative server. It is normal and not an error.

Can nslookup show the DNS server my PC is using?

Yes. Run nslookup with no arguments; the first lines show the default server and its IP address. In interactive mode, type server to see it.

Does nslookup work without an internet connection?

It can query a local DNS server if one is reachable on your network, but resolving public domains requires access to a DNS server that can reach the internet.