Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Learn

nslookup: how to look up DNS records from the command line

nslookup is a command-line tool that queries a DNS server for a record: run nslookup example.com for the IP address, or add -type=MX, -type=NS or -type=TXT for other records. A second argument picks the DNS server to ask, such as 1.1.1.1.

The short answer
  • Works on Windows, macOS and Linux. Syntax: nslookup [-type=TYPE] name [server].
  • "Non-authoritative answer" just means the reply came from a cache, not the zone owner.
  • Query the authoritative nameserver directly to see a record without caching.
Try the dns lookupFree, live, no signup

Which nslookup commands do you need most?

Noninteractive mode
GoalCommandNotes
IPv4 and IPv6 addressnslookup example.comUses your default resolver
Use a specific resolvernslookup example.com 1.1.1.1Second argument is the DNS server
Mail serversnslookup -type=MX example.comShows preference and exchanger
Nameserversnslookup -type=NS example.comDelegation as the resolver sees it
Text recordsnslookup -type=TXT example.comSPF, verification codes
Zone detailsnslookup -type=SOA example.comSerial and timers
Reverse lookupnslookup 8.8.8.8Returns the PTR name
More detailnslookup -debug example.comPrints packets sent and received

Syntax from Microsoft nslookup documentation. The Windows build tested here reported "unknown query type: CAA", so use dig for CAA records.

What does the output look like?

Real output on 2026-11-21 (your resolver and values will differ)
> nslookup -type=MX gmail.com
Server:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
gmail.com  MX preference = 5,  mail exchanger = gmail-smtp-in.l.google.com
gmail.com  MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com

> nslookup -type=SOA example.com
example.com
        primary name server = elliott.ns.cloudflare.com
        serial  = 2420077714
        default TTL = 1800 (30 mins)

How do you read the result?

  1. 01

    Server and Address (first lines)

    This is the resolver that answered you, not the domain DNS host. If it shows an unexpected name, your network is overriding your DNS setting.

  2. 02

    Non-authoritative answer

    The resolver answered from cache or by recursion. Ask the authoritative nameserver for an uncached answer.

  3. 03

    Record lines

    Check type and value. Add -debug to see the TTL of each record.

  4. 04

    Error text

    Nonexistent domain: the name does not exist. No records: the name exists but not that type. timed out: the server did not answer.

Interactive mode and alternatives

Interactive mode

Type nslookup alone, then set type=MX and enter names at the > prompt. Type exit to leave.

dig

Common on macOS and Linux, with fuller output and more options. See the dig command guide.

What is a sensible nslookup routine for a domain issue?

  • nslookup -type=NS example.com to find the authoritative nameservers
  • nslookup example.com ns1.dnshost.example to read the record from the source
  • nslookup example.com 1.1.1.1 and nslookup example.com 8.8.8.8 to compare public resolvers
  • nslookup example.com without a server to see what your own network returns

Common questions

What does nslookup do?

nslookup sends a query to a DNS server and prints the answer. It is used to find the IP address of a domain, list MX, NS or TXT records, and run reverse lookups from an IP address to a hostname.

How do I run nslookup on Windows?

Open Command Prompt or PowerShell and type nslookup followed by a domain. For a record type use nslookup -type=MX example.com. Entering nslookup alone starts interactive mode, which you leave with exit.

What does "non-authoritative answer" mean in nslookup?

It means the answer came from a resolver cache or a server that is not authoritative for the domain, not directly from the zone owner. The data is normally correct but may be as old as the TTL.

What is the difference between nslookup and dig?

Both query DNS. nslookup ships with Windows and prints a shorter summary. dig is common on Linux and macOS, shows flags, TTLs and each response section, and has options like +trace, so it suits deeper debugging.

How do I look up a specific nameserver with nslookup?

Add the server as the last argument: nslookup example.com ns1.dnshost.example. nslookup then asks that server directly instead of your default resolver, which shows what the zone itself says without cached data.

Why does nslookup show a different IP than my browser?

The browser may use its own cache, a different resolver such as DNS over HTTPS, or a hosts file entry, while nslookup talks to the configured DNS server directly. Compare both with the resolver specified explicitly.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.