1. Library
  2. Tools and Commands
  3. Dns Tools

Updated 10 hours ago

Every time you type a URL, your computer asks a question: "What's the IP address for this name?" A DNS server answers. This conversation happens invisibly, thousands of times a day.

Nslookup lets you ask those questions yourself—and hear the answers directly.

The Simplest Question

nslookup example.com

Output:

Server:  192.168.1.1
Address: 192.168.1.1#53

Non-authoritative answer:
Name:    example.com
Address: 93.184.216.34

You asked "what IP address is example.com?" and got an answer. But there's more information here:

Server: Who answered your question (your router or ISP's DNS server)

Non-authoritative answer: The server is being honest—"I heard this from someone else, don't blame me if it's wrong." It's returning cached information, not the official source.

Address: The IP address. This is what your browser actually connects to.

Asking a Different Server

Your default DNS server might have old information. Ask someone else:

nslookup example.com 8.8.8.8

Now you're asking Google's public DNS instead of your local one. If your DNS says one thing and Google says another, your DNS has stale cache—or your ISP is doing something suspicious.

nslookup example.com 8.8.8.8        # Google
nslookup example.com 1.1.1.1        # Cloudflare  
nslookup example.com 208.67.222.222 # OpenDNS

Comparing answers from multiple servers reveals whether a DNS problem is local to you or affecting everyone.

Asking Different Questions

DNS stores more than just IP addresses. You can ask for specific record types:

Where should email go?

nslookup -type=MX example.com
example.com mail exchanger = 10 mail1.example.com.
example.com mail exchanger = 20 mail2.example.com.

Lower numbers = higher priority. Email tries mail1 first, mail2 as backup.

Who's the authority here?

nslookup -type=NS example.com

Shows which nameservers are the official source for this domain.

What's the IPv6 address?

nslookup -type=AAAA example.com

What verification records exist?

nslookup -type=TXT example.com

TXT records often contain domain verification, SPF email policies, or other machine-readable data.

Is this name an alias?

nslookup -type=CNAME www.example.com
www.example.com canonical name = example.com.
Name: example.com
Address: 93.184.216.34

www.example.com doesn't have its own IP—it's an alias pointing to example.com, which then resolves to the actual address.

Getting the Authoritative Answer

Want to skip the middlemen and ask the official source?

First, find out who's authoritative:

nslookup -type=NS example.com

Then ask them directly:

nslookup example.com ns1.example.com

Now you're getting the answer straight from the source—no caching, no "I heard from someone else." This matters when you've just changed DNS records and want to verify they're correct before cache propagation.

Interactive Mode

For multiple questions, enter interactive mode:

nslookup
> example.com
> set type=MX
> example.com
> server 8.8.8.8
> example.com
> exit

You can change query types, switch DNS servers, and run multiple lookups without retyping the command.

Reading Error Messages

ErrorMeaning
NXDOMAINDomain doesn't exist. Misspelled, unregistered, or DNS not configured.
SERVFAILDNS server choked trying to resolve this. Usually a problem on their end.
REFUSEDDNS server won't answer you. May only accept queries from specific IPs.
TimeoutCan't reach any DNS server. Check your network connection.
No answerDomain exists but doesn't have the record type you asked for.

Troubleshooting Patterns

Website won't load:

nslookup example.com

If you get an IP, DNS is working—the problem is elsewhere (server down, firewall, routing). No answer or wrong IP means DNS is the culprit.

Did my DNS change propagate?

nslookup example.com ns1.example.com   # Authoritative (immediate)
nslookup example.com 8.8.8.8           # Google (may be cached)
nslookup example.com 1.1.1.1           # Cloudflare (may be cached)

The authoritative server shows new records immediately. Public DNS servers catch up as their caches expire.

Email isn't being delivered:

nslookup -type=MX example.com

No MX records = no email delivery to that domain.

What domain owns this IP?

nslookup 93.184.216.34

Reverse DNS lookup—useful for identifying unfamiliar IPs in logs.

Why Not dig?

Nslookup is considered deprecated by DNS purists. dig provides more detail, better formatting, DNSSEC validation, and consistent cross-platform behavior.

But nslookup is everywhere. It's on every Windows machine. It answers the question you're actually asking. For "what IP is this domain?" or "does this MX record exist?", nslookup is fast and sufficient.

Use dig when you need TTL values, timing information, or you're debugging complex DNS chains. Use nslookup when you just need a quick answer.

Frequently Asked Questions About nslookup

Was this page helpful?

😔
🤨
😃
nslookup • Library • Connected