nslookup (Name Server Lookup) is a cross-platform DNS query tool built into Linux, macOS, and Windows. It's the go-to option when dig isn't available — letting you look up any DNS record type and query any DNS server directly.
nslookup asks a DNS resolver to translate a name into records (or vice-versa for reverse lookups). It can run in non-interactive mode (single command) or interactive mode (a shell-like prompt for multiple queries).
nslookup works on every platform without installing anything extra — making it the universal DNS troubleshooting tool.
Unlike dig, nslookup uses its own resolver stack rather than the system's, which can occasionally produce different results. For authoritative queries, always test against a known-good server like 8.8.8.8 or 1.1.1.1.
| Field | Meaning |
|---|---|
| Server | The DNS server that was queried |
| Address | IP and port of the DNS server (port 53 = DNS) |
| Non-authoritative | Answer came from a cache, not the domain's own nameserver |
| Name / Address | The resolved hostname and IP address |
Launch nslookup without arguments to enter interactive mode — useful for running multiple queries without retyping the tool name each time.
| Interactive command | What it does |
|---|---|
| server <ip> | Switch to querying a different DNS server |
| set type=<type> | Change the record type (A, MX, TXT, NS, CNAME…) |
| set debug | Show full DNS packet details |
| set nodebug | Turn off debug output |
| set timeout=<n> | Set query timeout in seconds |
| exit | Leave interactive mode |
| nslookup | dig | |
|---|---|---|
| Availability | Built into Linux, macOS, Windows | Linux, macOS (install on Windows) |
| Output | Simplified, human-readable | Full raw DNS response |
| Scripting | Limited — output harder to parse | Excellent with +short, +noall |
| Interactive mode | Yes | No |
| DNSSEC | Basic support | Full support with +dnssec |
| Best for | Quick checks, Windows environments | Deep DNS debugging, scripting |
| Problem | Command | What to check |
|---|---|---|
| Domain not resolving | nslookup domain.com 8.8.8.8 | If 8.8.8.8 works but default fails, your local resolver is the problem |
| Wrong IP returned | nslookup domain.com 1.1.1.1 | Compare with your default resolver — stale cache or hijacked DNS |
| Email issues | nslookup -type=MX domain.com | Verify MX records and their priority |
| SSL / certificate mismatch | nslookup -type=CNAME domain.com | Check if CNAME points to the expected CDN or load balancer |
| NXDOMAIN error | nslookup -type=NS domain.com | Confirm NS records exist — domain may not be delegated |
nslookup domain.com <nameserver>