User Agents

Web browsers and everyday web tech, explained

Flush DNS Cache: Guide for Windows, Mac, Linux and Chrome

· 7 min read · Cookies and Cache

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Flushing your DNS cache clears the local database of IP addresses that your computer stores to speed up website loading. When a website changes its server or IP address, your computer may still try to use the old, cached information, leading to "Page Not Found" errors or connection timeouts. By performing a DNS flush, you force your operating system and browser to request the most current IP address from the DNS servers, effectively resolving connectivity issues caused by outdated records.

What You'll Need

  • A computer running Windows, macOS, or a Linux distribution.
  • Administrative or root privileges (required to execute system-level network commands).
  • The Google Chrome browser installed (if you intend to clear the browser-specific DNS cache).
  • A stable internet connection to verify the results after the flush.

Step-by-Step

  1. Flushing DNS on Windows 10 and 11

    Windows uses a built-in utility called the DNS Client service. To clear this cache, you must use the Command Prompt with elevated permissions.

    • Click the Start button or press the Windows key.
    • Type cmd into the search bar.
    • Right-click on Command Prompt and select Run as administrator. This is a critical step; the command will fail without administrative rights.
    • In the black terminal window, type the following command exactly: ipconfig /flushdns
    • Press Enter.
    • You should see a confirmation message stating: "Successfully flushed the DNS Resolver Cache."
  2. Flushing DNS on macOS

    Unlike Windows, macOS commands vary slightly depending on the version of the operating system you are running. Most modern versions (Ventura, Monterey, Big Sur) use a similar command via the Terminal.

    • Open Finder, go to Applications, then Utilities, and launch Terminal. Alternatively, use Spotlight (Cmd + Space) and search for "Terminal".
    • For macOS Big Sur and later, type: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    • Press Enter.
    • The system will prompt you for your administrator password. Type it in (note that the cursor will not move and characters will not appear as you type for security reasons) and press Enter again.
    • There is usually no success message in macOS; if the prompt returns to a new line without an error, the cache has been cleared.
  3. Flushing DNS on Linux

    Linux does not have a single universal DNS cache because different distributions use different services (such as systemd-resolved, nscd, or dnsmasq). You must identify which service your system is using.

    • Open your Terminal.
    • For systemd-resolved (most common in Ubuntu/Fedora): Type sudo resolvectl flush-caches or sudo systemd-resolve --flush-caches and press Enter.
    • For nscd: Type sudo /etc/init.d/nscd restart or sudo service nscd restart and press Enter.
    • For dnsmasq: Type sudo systemctl restart dnsmasq and press Enter.
    • To verify the flush on systemd-resolved, you can run sudo resolvectl statistics to see the cache size return to zero or decrease.
  4. Flushing DNS in Google Chrome

    Chrome maintains its own internal DNS cache separate from the operating system. Even if you flush Windows or Mac DNS, Chrome might still hold onto the old record.

    • Launch the Google Chrome browser.
    • In the address bar, type the following URL exactly: chrome://net-internals/#dns
    • Press Enter. This opens a hidden internal diagnostic page.
    • Look for the button labeled Clear host cache.
    • Click the button. There is no confirmation pop-up, but the internal table is cleared immediately.
    • For a complete refresh, it is also recommended to go to chrome://net-internals/#sockets and click Flush socket pools to close any active connections to the old IP address.

Common Mistakes

One of the most frequent errors is attempting to run the ipconfig /flushdns command in a standard Command Prompt window rather than an Administrator window. If you see an "Access Denied" or "Requested operation requires elevation" message, it means you forgot to right-click and select Run as administrator.

Another common mistake is forgetting that browsers have their own caches. Users often flush the OS-level DNS and wonder why the website still isn't loading. Because Chrome, Firefox, and Edge often implement their own DNS caching mechanisms to improve speed, you must clear the browser's internal cache (as detailed in the Chrome steps) in addition to the system cache.

On macOS and Linux, users often get confused when the Terminal does not provide a "Success" message. Unlike Windows, Unix-based systems typically follow the "silence is golden" rule; if the command executes and returns you to the command prompt without an error message, the operation was successful.

Finally, some users confuse flushing the DNS cache with clearing the browser's cookies and history. While both can solve loading issues, clearing your history does not remove the DNS mapping of a domain name to an IP address. You must specifically target the DNS cache for network-level resolution issues.

Tips

To ensure a completely clean slate, follow a "top-down" clearing approach. Start by flushing the operating system DNS, then clear the browser's internal DNS cache, and finally restart the browser. This prevents the browser from simply re-populating its cache from a still-contaminated OS cache.

If you frequently manage websites or servers and find yourself flushing DNS often, you can create a simple batch file (on Windows) to automate the process. Open Notepad, type ipconfig /flushdns, and save the file as flush.bat. Whenever you need to clear the cache, just right-click that file and run it as an administrator.

When troubleshooting a specific website, use the nslookup command in your terminal (e.g., nslookup example.com). This allows you to see which IP address the DNS server is currently providing. If nslookup shows the correct IP but your browser still goes to the old one, you know the issue is definitely a local cache problem and not a server-side propagation issue.

Consider switching to a public DNS provider like Google (8.8.8.8) or Cloudflare (1.1.1.1) if you find that your ISP's DNS servers are slow to update records. This reduces the frequency with which you'll need to manually flush your cache during site migrations.

Troubleshooting

If you have flushed your DNS and the website still fails to load, the issue may be related to DNS Propagation. When a website owner changes their DNS records, it can take anywhere from a few minutes to 48 hours for those changes to spread across every DNS server globally. In this case, no amount of local flushing will fix the problem; you simply have to wait for the global servers to update.

If you receive an error stating that the DNS client service is not running on Windows, you can restart it via the Services manager. Press Win + R, type services.msc, find DNS Client, right-click it, and select Restart. If the option is greyed out, it is because the service is protected by the system, and a full computer reboot is the best way to reset it.

On Linux, if resolvectl is not found, your distribution may be using an older version of systemd or a different resolver entirely. Try checking your /etc/resolv.conf file to see which DNS servers are configured. If you are using bind or unbound, you will need to restart those specific services using systemctl restart.

If the "Clear host cache" button in Chrome doesn't seem to work, try opening the site in an Incognito Window (Ctrl+Shift+N). Incognito mode often bypasses certain cached elements. If the site works in Incognito but not in a standard window, you may need to clear your browser's general cache and cookies in addition to the DNS cache.

Frequently Asked Questions

Will flushing my DNS delete my passwords or bookmarks?

No. Flushing the DNS cache only removes the temporary map of website names to IP addresses. It does not affect your browser history, saved passwords, cookies, or bookmarks.

Is it safe to flush DNS frequently?

Yes, it is completely safe. The only downside is a negligible decrease in loading speed for the very first time you visit a site after the flush, as your computer must ask the DNS server for the IP address again.

Why do I need to use "sudo" or "Administrator" mode?

The DNS cache is a system-level resource used by all applications on the computer. To prevent malicious software from redirecting your traffic to fake websites, operating systems restrict the ability to modify or clear this cache to users with administrative privileges.

What is the difference between a DNS flush and a hard refresh?

A hard refresh (Ctrl+F5) tells the browser to ignore the cached files (images, CSS, JS) of a specific page and download them fresh. A DNS flush tells the entire computer to forget the IP address associated with a domain name.

Can flushing DNS fix a "404 Not Found" error?

Only if the 404 is caused by your computer trying to connect to an old, decommissioned server. If the page has been deleted from the actual server, flushing your DNS will not bring the page back.

How often should I flush my DNS?

There is no need to do this on a schedule. You should only flush your DNS when you are experiencing connectivity issues, after changing your DNS settings, or when a website you manage has moved to a new server.