nslookup queries DNS servers. It’s older than dig and shows less detail, but it has one big advantage: it’s built into Windows, as well as macOS and most Linux systems. When you’re helping someone check DNS from a Windows PC — or working on a Windows VPS — nslookup is the tool at hand.
On Linux, install it with sudo apt install dnsutils (or bind-utils on RHEL-family systems).
Basic lookup
nslookup example.com
Server: 1.1.1.1
Address: 1.1.1.1#53
Non-authoritative answer:
Name: example.com
Address: 93.184.215.14
- Server — the resolver that answered (your configured DNS).
- Non-authoritative answer — the answer came from a resolver’s cache, not directly from the domain’s own nameservers. That’s normal.
Query a specific DNS server
Add the server as a second argument:
nslookup example.com 8.8.8.8
nslookup example.com ns1.your-dns-provider.com
Asking the domain’s authoritative nameserver shows the current truth without caching — the way to confirm a DNS change was saved correctly.
Other record types
nslookup -type=MX example.com
nslookup -type=TXT example.com
nslookup -type=NS example.com
nslookup -type=AAAA example.com
nslookup -type=CNAME www.example.com
nslookup -type=SOA example.com
nslookup -type=TXT _dmarc.example.com
(-query= is a synonym for -type=.) On Windows PowerShell, quote it if needed: nslookup "-type=MX" example.com.
Reverse lookup
nslookup 203.0.113.10
Returns the PTR record (hostname) for an IP — important for mail servers. See PTR records.
Interactive mode
Run nslookup without arguments to get a prompt:
> server 1.1.1.1
> set type=MX
> example.com
> set type=TXT
> example.com
> set debug
> example.com
> exit
set debug shows full response details including TTLs — closer to what dig shows by default.
Common tasks
Check that a domain points to your new server
nslookup example.com
nslookup www.example.com
nslookup example.com ns1.your-dns-provider.com
If the authoritative server has the new IP but your resolver doesn’t, wait for the TTL to expire — see DNS propagation.
Check email DNS
nslookup -type=MX example.com
nslookup -type=TXT example.com
nslookup -type=TXT default._domainkey.example.com
nslookup -type=TXT _dmarc.example.com
See MX records and SPF, DKIM and DMARC.
Flush the local DNS cache on Windows after changing records:
ipconfig /flushdns
On Windows, Resolve-DnsName in PowerShell is a modern alternative with structured output:
Resolve-DnsName example.com -Type MX
Resolve-DnsName example.com -Server 1.1.1.1
Reading errors
| Message | Meaning |
|---|---|
** server can't find example.com: NXDOMAIN |
The name doesn’t exist |
** server can't find …: SERVFAIL |
The resolver failed — broken nameservers or DNSSEC problems |
*** Request to 8.8.8.8 timed-out |
Can’t reach that DNS server (firewall, network) |
*** Can't find example.com: No answer |
The name exists, but has no record of that type |
nslookup vs dig
| nslookup | dig | |
|---|---|---|
| Available on Windows | Yes, built in | No (installable) |
| Output detail | Basic | Full (flags, TTLs, sections) |
| Trace delegation | No | +trace |
| Scripting | Awkward | +short is ideal |
| DNSSEC details | Limited | Yes |
Use nslookup for quick checks anywhere; reach for dig on Linux when you need the details.
Related: DNS records explained and changing DNS servers on Linux.