How To Use The Nslookup Command In Windows (2027)
Nslookup is the built-in Windows tool for asking a DNS server what IP address sits behind a name.
Open Command Prompt, type nslookup example.com and press Enter to get an answer in a second or two.
This guide covers the one-line lookups, the interactive mode and what each error message means, all taken from Microsoft’s own documentation.
Table of Contents
- Nslookup quick answers
- What the nslookup command does
- How to open the command line
- Look up a name or IP address (noninteractive mode)
- Ask a different DNS server
- Useful command-line options
- Use interactive mode for several lookups
- Interactive subcommands
- Subcommands you rarely need
- How the search list affects names
- What the nslookup error messages mean
- What to do when lookups fail
- Official sources
- More Windows guides
Nslookup quick answers
| I want to | Type this |
|---|---|
| Look up the IP address of a name | nslookup mydomain.com |
| Look up the name behind an IP address | nslookup 4.4.4.4 |
| Ask a specific DNS server | nslookup mydomain.com 1.1.1.1 |
| Return only IPv6 (AAAA) records | nslookup -type=AAAA mydomain.com |
| Start interactive mode | nslookup |
What the nslookup command does
Microsoft describes nslookup as a tool that displays information you can use to diagnose Domain Name System (DNS) infrastructure.
It works on Windows 11 and Windows 10, plus the supported Windows Server releases.
Microsoft notes that the tool is available only if the TCP/IP protocol is installed, which is the case on a normal Windows PC.
Nothing needs to be downloaded, because the command ships with Windows.
How to open the command line
- Press the Windows key and type cmd.
- Select Command Prompt from the results.
- Type your nslookup command and press Enter.
The command also runs in PowerShell and in scripts, because noninteractive mode is built for single lookups in command lines.
You do not need administrator rights for a plain lookup.
To open the console with elevated rights anyway, follow our guide to opening Terminal as administrator in Windows 11.
Look up a name or IP address (noninteractive mode)
In noninteractive mode the first parameter is the name or IP address you want to look up.
The optional second parameter is the name or IP address of a DNS name server.
If you leave the second one out, nslookup uses your default DNS name server.
- Type
nslookup mydomain.comto see the IP addresses for that name from your default server. - Type
nslookup 4.4.4.4to see the domain name for an IP address. - Type
nslookup mydomain.com 1.1.1.1to send the same question to the server at 1.1.1.1 instead.
Microsoft explains that when you look up an IP address and the query is for an A or PTR record type, the name of the computer is returned.
Ask a different DNS server
Naming a second server is the quickest way to tell whether your own DNS server is the problem.
If the default server fails but another server answers, the fault sits with the default server and not with the site.
To change which server Windows uses day to day, see how to change the DNS server in Windows 11.
Useful command-line options
| Option | What it does |
|---|---|
-debug | Turns on debug output so you can see more about the packets sent. |
-type=AAAA | Returns only IPv6 (AAAA) records. |
-type=A+AAAA | Returns both IPv4 and IPv6 addresses, as in Microsoft’s combined example. |
-nosearch | Skips the DNS domain search list. |
-recurse | Asks the server to query other servers when it lacks the answer. |
Microsoft’s page shows these combined in one line: nslookup -debug -type=A+AAAA -nosearch -recurse mydomain.com 1.1.1.1.
Use interactive mode for several lookups
Interactive mode suits you when you have several names to look up or several settings to change.
- Type
nslookupon its own and press Enter, or typenslookup - 1.1.1.1to start with a chosen default server. - Wait for the prompt to change to >.
- Type a name or IP address on each line to look it up.
- Type
exitto leave.
Press Ctrl+B at any time to interrupt an interactive command.
An unrecognized command is read as a computer name, so put a backslash before a built-in command word when you really mean a host with that name.
Interactive subcommands
| Subcommand | What it does |
|---|---|
server | Changes the default server to the one you name. |
set all | Prints the current values of the configuration settings. |
set type=HINFO | Changes the resource record type for the query. |
set debug | Turns debugging mode on or off. |
set timeout | Changes how many seconds nslookup waits for a reply. |
set retry | Sets the number of retries. |
help | Shows a short summary of subcommands. |
A typical session on Microsoft’s page runs set all, looks up a domain, then switches to server 4.4.4.4 and repeats the lookup.
Subcommands you rarely need
The ls subcommand lists information for a DNS domain, and view sorts and lists the output of the previous ls command.
The root subcommand changes the default server to the server for the root of the DNS domain name space.
The set port subcommand changes the default TCP/UDP DNS name server port to the value you give it.
Microsoft notes that a Connection refused message commonly shows up with ls and finger requests.
How the search list affects names
When the name you type has no trailing period, nslookup appends the default DNS domain name before it asks.
That behavior depends on the domain, srchlist, defname and search settings.
With search turned on, the DNS domain names in your search list are added to the request until an answer comes back, provided the name contains at least one period but does not end with one.
Add a trailing period to a name, as in mydomain.com., when you want to be sure only that exact name is queried.
What the nslookup error messages mean
| Message | Meaning (per Microsoft) |
|---|---|
| timed out | The server did not respond after a certain time and number of retries. Adjust with set timeout and set retry. |
| No response from server | No DNS name server is running on the server computer. |
| No records | The name is valid, but the server has no records of the current query type. Set the type with set querytype. |
| Nonexistent domain | The computer or DNS domain name does not exist. |
| Server failure | The server found an internal inconsistency in its database and could not return a valid answer. |
| Refused | The DNS server refused to service the request. |
| Connection refused or Network is unreachable | The connection to the DNS server or finger server could not be made, which commonly happens with ls and finger requests. |
What to do when lookups fail
- Run the lookup again against a different server, such as
nslookup mydomain.com 1.1.1.1. - If only your default server fails, change your DNS server in Windows.
- If every server times out, check the connection itself with Ping and Tracert.
- If a name returns No records, retry with another query type.
You can also review open connections with Netstat when a program seems to reach the wrong host.
Official sources
Everything above comes from Microsoft’s nslookup reference.
Microsoft also publishes a Command-Line Syntax Key that explains the brackets and braces in its syntax lines.
More Windows guides
- How To Use The Tasklist And Taskkill Command In Windows (2027)
- How To Use The Robocopy Command In Windows (2026)
- How To Use The Xcopy Command In Windows (2026)
- How To Use The Attrib Command In Windows (2026)
- How To Use The Cipher Command In Windows (2026)
- How To Use The Bcdedit Command In Windows (2026)
See all: Windows 11 Guides