Names Organizer
Windows 10 & 11 Buy license · $49.95
DNS and security

How to Check DNS Records on Windows With nslookup and PowerShell

How to check DNS records on Windows with nslookup and Resolve-DnsName: look up A, MX, TXT and NS records, query a specific server and read results.

Updated 5 minute read The Names Organizer team

To check DNS records on Windows, open Command Prompt and run nslookup -type=a example.com, swapping a for mx, txt, ns, cname or soa to see other record types. In PowerShell, the equivalent is Resolve-DnsName example.com -Type MX, which gives tidier output and is easier to script. To see the current, authoritative answer rather than a cached one, add a server: query the domain's own nameserver, or a public resolver, at the end of the command.

Both tools are built into Windows 10 and Windows 11, so you do not need to install anything. Below are the exact commands for each record type, how to read the results, and how to deal with cached answers.

Opening the tools

  • Command Prompt: press Win + R, type cmd and press Enter. Or search for Command Prompt in the Start menu.
  • PowerShell or Windows Terminal: right-click the Start button and choose Terminal (Windows 11) or Windows PowerShell (Windows 10).

You do not need administrator rights for lookups. You only need them for some cache commands.

nslookup commands for each record type

RecordCommandWhat it shows
Anslookup -type=a example.comIPv4 address of the site
AAAAnslookup -type=aaaa example.comIPv6 address
CNAMEnslookup -type=cname www.example.comThe name an alias points to
MXnslookup -type=mx example.comMail servers and their priorities
TXTnslookup -type=txt example.comSPF, verification and other text records
DMARCnslookup -type=txt _dmarc.example.comThe domain's DMARC policy
NSnslookup -type=ns example.comThe domain's nameservers
SOAnslookup -type=soa example.comPrimary nameserver, serial number and timers

A plain nslookup example.com returns A and AAAA records. Asking for -type=any is rarely useful now, because many DNS servers deliberately return a minimal answer to that query.

Reading nslookup output

The first two lines show which DNS server answered, usually your router or your internet provider's resolver. "Non-authoritative answer" means the result came from a resolver's cache rather than directly from the domain's own nameserver. That is normal, but it can be out of date if a record was changed recently.

Querying a specific DNS server

Add the server name or IP address at the end of the command:

  • nslookup -type=mx example.com 1.1.1.1 asks Cloudflare's public resolver.
  • nslookup -type=mx example.com 8.8.8.8 asks Google's public resolver.
  • nslookup -type=mx example.com ns1.yourdnsprovider.com asks the domain's own nameserver directly.

To get the current, authoritative record:

  1. Run nslookup -type=ns example.com and note one of the nameservers.
  2. Run your query again with that nameserver at the end.
  3. Compare the answer with what your normal resolver returns. If they differ, your resolver is still serving a cached copy, which will update when its time to live (TTL) runs out.

Using PowerShell's Resolve-DnsName

PowerShell's built-in cmdlet does the same job with clearer output:

  • Resolve-DnsName example.com -Type A
  • Resolve-DnsName example.com -Type MX
  • Resolve-DnsName example.com -Type TXT
  • Resolve-DnsName example.com -Type NS -Server 1.1.1.1
  • Resolve-DnsName example.com -Type A -DnsOnly skips other name-resolution methods such as the hosts file.

The output includes the TTL in seconds for each record, which tells you how long resolvers may cache it. For a quick record of all the main types, you can run several lines and pipe the results to a file, for example by adding | Out-File dns.txt -Append to each command.

Copy and paste the TXT record exactly as returned when checking SPF or DKIM. Long TXT records may be split into several quoted strings, which DNS joins together.

When the answer looks wrong: caches

Windows keeps its own DNS cache, and so does your browser. If a site still loads the old server after a change:

  1. Run ipconfig /flushdns in Command Prompt, or Clear-DnsClientCache in PowerShell (run as administrator).
  2. Restart the browser, which clears its separate cache.
  3. Run ipconfig /displaydns if you want to see what Windows currently has cached.
  4. Check the hosts file at C:\Windows\System32\drivers\etc\hosts for a leftover entry overriding the domain.

Your router and your internet provider also cache answers, and you cannot clear those. Query a public resolver or the authoritative nameserver to see past them. For how long caches can hold records, see what TTL to use for DNS.

Interactive mode for several lookups

If you are checking many records on one domain, type nslookup on its own and press Enter. You get a > prompt where you can type commands one after another:

  1. server 1.1.1.1 switches the DNS server for the rest of the session.
  2. set type=mx sets the record type.
  3. Type the domain name, such as example.com, to run the query.
  4. set type=txt, then the domain again, to see TXT records.
  5. exit to leave.

This saves retyping and makes it easy to compare the same record across several servers.

Common errors and what they mean

MessageLikely meaning
Non-existent domainThe name does not exist in DNS: a typo, an unregistered domain, or a domain that has expired or been put on hold
No response from server or timed outThe DNS server you asked is unreachable or not answering
Answer but no records of that typeThe domain exists but has no record of that type, for example no MX
Server failedThe resolver could not get an answer, often a problem with the domain's nameservers or DNSSEC

A non-existent domain result for a name you own is urgent. Check its expiry date and status straight away; our guide on whether a website is down because of the domain or the hosting walks through it.

Keeping a record of your DNS

Looking up records is easy. Knowing what they were last month, for every domain you own, is harder, and it is exactly what you need when something breaks or before you move hosts. Names Organizer, a domain manager for Windows, stores each domain's nameservers and DNS records alongside its registrar and expiry details, and it can warn you when nameservers or DNS records change unexpectedly. Its DNS and nameservers report lists the records per domain and can be printed or saved as PDF or text, which is handy before a website move or an audit. You still make changes at your DNS provider, but with Names Organizer you have a reference copy to compare against.

Frequently asked questions

How do I look up MX records on Windows?

Open Command Prompt and run nslookup -type=mx yourdomain.com, or in PowerShell run Resolve-DnsName yourdomain.com -Type MX.

Why does nslookup show a different result than my DNS provider?

Your resolver may be serving a cached answer. Query the domain's own nameserver directly to see the current authoritative records.

How do I clear the DNS cache on Windows?

Run ipconfig /flushdns in Command Prompt. Browsers keep their own cache too, so restart the browser if a site still looks old.

Get three guides like this every month, plus software update notices.Subscribe →