Your Search Bar For Shrewd Tips

How Do I Clear Nslookup Cache?


If a website has moved to a new server, a domain name resolves to an outdated address, or a recent DNS change does not seem to be working, you may wonder how to clear the nslookup cache. The important detail is that nslookup is a command-line tool for looking up DNS records; it generally does not keep its own persistent cache. The information you see may instead be coming from your computer’s DNS cache, a browser, a router, or the DNS server that nslookup is querying.

To fix a stale DNS result, identify which cache is involved and clear the appropriate one. This guide explains how to use nslookup, flush DNS caches on Windows, macOS, and Linux, and check whether a DNS server is still returning an old record.

Does nslookup Have a Cache?

In typical use, nslookup sends a DNS query to a DNS server and displays the response. It does not provide a standard command for flushing a built-in, persistent nslookup cache. So, if you are searching for an nslookup flush cache command, there usually isn’t one to run.

DNS results can be cached in several places along the path between your device and a website. Your operating system may temporarily remember a previous lookup. A browser may maintain its own DNS or connection information. A home router may cache queries, and a recursive DNS resolver operated by your internet provider or another DNS service can cache answers as well.

That distinction matters: flushing your computer’s DNS cache clears only that computer’s local entries. It does not automatically clear a router’s cache or force a public DNS server to discard an answer before its time-to-live, or TTL, expires.

How to Check a DNS Result with nslookup

Before clearing anything, use nslookup to see which DNS answer you are receiving and which server provided it. Open a terminal or command prompt and enter:

nslookup example.com

Replace example.com with the domain you want to check. The output typically shows the DNS server used for the query, followed by the domain name and its returned address. The exact format varies by operating system and DNS server.

You can also specify a DNS server to compare answers. For example, the following command asks Google Public DNS directly:

nslookup example.com 8.8.8.8

To query Cloudflare’s public DNS instead, use:

nslookup example.com 1.1.1.1

If your normal lookup returns an old address but a direct query to another resolver returns a new one, the discrepancy may point to a cached answer or a DNS propagation delay. It does not, by itself, prove which device or server is responsible. DNS record changes can take time to appear consistently because resolvers may retain earlier answers until their TTL expires.

How to Clear the DNS Cache on Windows

On Windows, DNS lookups may be stored by the DNS Client service. To clear the local cache, open Command Prompt or Windows Terminal. For the simplest approach, search for Command Prompt, right-click it, and choose Run as administrator. Then enter:

ipconfig /flushdns

Windows should display a message confirming that the DNS Resolver Cache was flushed. This clears cached DNS entries on that computer; it does not clear caches held by your router, browser, or an external DNS server.

You can also run the command from an elevated PowerShell window. The command is the same:

ipconfig /flushdns

After flushing the cache, try the lookup again:

nslookup example.com

If you are troubleshooting a browser, close and reopen it as well. Some browsers keep DNS information or existing network connections separately from the Windows cache. If the result remains outdated, try another DNS server with nslookup to help determine whether the issue is local or upstream.

How to Clear the DNS Cache on macOS

On current versions of macOS, open Terminal and run these commands:

sudo dscacheutil -flushcache

sudo killall -HUP mDNSResponder

Enter your Mac account password if prompted. Terminal may not show characters as you type the password; this is normal. Press Return when you are done. These commands ask macOS to clear its directory-service cache and signal the mDNS responder to reload its DNS-related state.

There may be no success message. To check the result, run a fresh lookup:

nslookup example.com

macOS commands and DNS behavior can differ between releases, so if these commands do not help, restart the Mac and test again. Also check whether a VPN, security app, or custom DNS profile is directing queries to a particular server.

How to Clear the DNS Cache on Linux

Linux does not have one universal DNS-cache command. Some systems cache lookups with systemd-resolved, while others may use services such as nscd or dnsmasq. Some configurations do not run a local DNS cache at all. Use the option that matches the service on your system.

For systems using systemd-resolved, run:

sudo resolvectl flush-caches

On older distributions, the equivalent command may be:

sudo systemd-resolve --flush-caches

If your system uses nscd, you can restart that service with:

sudo systemctl restart nscd

If it uses dnsmasq, restart the service with:

sudo systemctl restart dnsmasq

Service names and commands can vary by distribution. If a command reports that the service does not exist, that likely means the service is not installed or is not managing DNS on that machine. Check your distribution’s documentation or inspect the active resolver configuration before restarting services. Once you have cleared the relevant cache, test again with nslookup example.com.

What If nslookup Still Shows the Old Address?

If flushing your computer’s cache does not change the result, the stale answer may be coming from another point in the DNS path. Work through these checks:

  • Compare DNS servers. Query your usual server and a different trusted resolver with nslookup example.com 8.8.8.8 or nslookup example.com 1.1.1.1. Different answers can indicate that the resolvers have not updated at the same time.
  • Check the DNS record and TTL. Confirm that the domain’s A, AAAA, or CNAME record has the intended value. A resolver may continue using an earlier response until its TTL expires.
  • Restart or inspect your router. Some routers cache DNS responses or forward queries to your internet provider’s DNS servers. Restarting the router may clear its local state, but it cannot force an upstream resolver to discard a cached answer.
  • Check VPN and network settings. A VPN, managed workplace network, or custom DNS configuration may send queries to a different resolver than the one you expect.
  • Test another device or network. If the problem happens only on one device, focus on its local cache and settings. If it occurs across multiple devices on the same network, check the router or DNS provider.
  • Allow time for updates. DNS changes are not always visible everywhere immediately. Wait for the previous record’s TTL to expire, then check again.

For more detailed troubleshooting, use a DNS diagnostic tool such as dig where available. It can show additional information, including TTL values. Remember that a lookup tool reports what the queried server returned; it does not guarantee that every resolver around the world has the same answer.

Clear Browser DNS and Connection Data

If nslookup returns the correct address but a website still loads an old page or fails to connect, the issue may not be the operating system’s DNS cache. A browser can keep DNS information, reuse an existing connection, or store website data such as cookies and cached files.

First, close and reopen the browser, then try a private or incognito window. You can also test the site in a different browser. If those steps work, clear the affected browser’s cached files or DNS-related data using its settings. Browser options change over time, so consult the browser’s current support instructions for the exact steps.

Be aware that clearing browser data may sign you out of websites or remove saved site preferences, depending on what you select. It is usually unnecessary to erase all browsing data simply to troubleshoot a DNS lookup. Start with a browser restart and a comparison using another browser.

Common Mistakes When Clearing an nslookup Cache

A frequent mistake is trying to flush the cache from inside the nslookup prompt. The interactive tool accepts commands such as server to choose a DNS server and exit to quit, but it does not offer a general command to clear the operating system’s DNS cache. Exit the tool and run the appropriate cache-flush command in your system terminal instead.

Another common misunderstanding is assuming that a successful local flush clears DNS everywhere. It does not. Each cache is managed separately, and a recursive resolver can keep a valid answer until its TTL runs out. Repeatedly flushing your computer will not shorten that TTL or update a DNS record that is still incorrect at its source.

Finally, make sure you are checking the correct record type. A domain can have different IPv4, IPv6, or alias records, and a site may use multiple addresses. If you are diagnosing a specific connection problem, compare the relevant records and test the hostname that the application actually uses.

Conclusion

To clear an “nslookup cache,” first remember that nslookup is a DNS lookup tool, not usually the cache itself. Flush your computer’s DNS cache with ipconfig /flushdns on Windows, the appropriate dscacheutil and mDNSResponder commands on macOS, or the cache-service command used by your Linux distribution. Then run nslookup again and compare results from different DNS servers if needed.

If the old address persists, check your browser, router, VPN, DNS provider, record values, and TTL. Clearing the correct cache—and confirming which DNS server is returning the answer—is the most reliable way to troubleshoot a stale DNS result.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


💡 Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments 👇

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum →