Are you encountering internet connection issues or facing trouble accessing a website? It may be due to DNS corruption or dumping in your Windows PC. In this tutorial, we’ll discuss 6 methods to flush or clear the DNS cache in Windows 11 and 10. Before we dig into the various ways to flush the DNS cache, let’s learn what it is and how it works.

Domain Name System translates human-readable domain names (like www.example.com) into IP addresses (like 192.0.2.1). When you visit a website, your computer sends a request to a DNS server asking for the IP address associated with the domain name. The server responds with the requested IP address, and your computer loads the website. DNS caching is used to speed up the process of resolving domain names to IP addresses.

So, why and when do we need to clear the DNS cache? There can be many answers to this question but the most common reasons are:

  • The cache has corrupted or it’s out of date.
  • The DNS settings for a domain have been recently changed.
  • If a website has moved to a different server and it’s not loading properly.
  • Clearing the DNS can also fix the “404 Page Not Found” error in some cases.
  • If you want to view the most up-to-date version of a website.

If you’re having trouble connecting to a website or service, one of the first things you can do is flush your DNS cache. This will reset your saved information and fetch new data from the server.

Table of Content

1. Using Flush DNS Command in CMD

If you want to clear your DNS cache on Windows, you can do so by using the Command Prompt. Follow these steps:

  1. Open a Command Prompt window.
  2. Execute the following command in the Command Prompt window.
    ipconfig /flushdns

    flush dns cache via windows command prompt

  3. When the DNS record is cleared, you’ll get the following output in the CMD window.
    Windows IP Configuration
    Successfully flushed the DNS Resolver Cache.

That’s it!

2. Using DNS Cache Command in PowerShell

You can also clear the DNS record in Windows 10 and 11 using a PowerShell command.

  1. Launch a PowerShell window.
  2. Type or paste the following command in the PowerShell window.
    Clear-DnsClientCache
  3. Once you hit Enter, your DNS cache will be cleared and you’ll be good to go.clear dns cache in windows powershell

3. Using Flush DNS Command via the Run Dialog

Another quick way to clear the DNS in Windows involves using the Run dialog box. Here’s how to do it.

  1. Open the Run dialog box on your PC. You can do so by using the Windows + R keyboard shortcut to launch it.
  2. When the Run dialog is launched, type or paste the following command in the text box next to Open.
    ipconfig /flushdns

    fluch dns cache using windows run dialog

  3. Now, click the OK button. If you want to run the ipconfig /flushdns command as an administrator, press Ctrl + Shift + Enter keys after typing the command in the Run dialog.
How to Install Apps from Unknown Publishers on Windows 10/11

4. Flush DNS using a Batch File

Flushing DNS via a batch file might seem complicated but it works flawlessly. The good thing about this method is if you create a batch file once, you run it whenever you want to managee the DNS. Here is how to do it.

  1. Open the Notepad app. You can find it among the pre-installed apps on your PC. You can also use the Windows Search feature and type Notepad to find the app quickly.search for notepad in windows
  2. Now, type or paste one of the following entries in the Notepad file.
    ipconfig /flushdns

    or

    cmd.exe /k ipconfig /flushdns

    type the flush dns command in notepad file

  3. Click File > Save or press Ctrl + S keyboard shortcut to save the file.notepad file saving option
  4. When the Save as window pops up, click next to Save as type and select All files(*.*).select all files type to save notepad
  5. Next, type FlushDNS.bat, ClearDNS.bat, or any other name (with ‘.bat‘ extension) that you prefer in the File name section and click the Save button.save flush dns batch file in windows
  6. Navigate to the FlushDNS.bat or ClearDNS.bat file and double-click it.run flush dns batch file to clear dns cache in windows
  7. Doing so will launch the Command Prompt and execute the ipconfig /flushdns command.

5. Flush DNS Automatically via Registry

Using the Windows Registry editor hack below, you can schedule the flushing or clearing of the DNS cache. Let’s see how we can do this.

Warning: Before you proceed with the steps below, please create a system restore point and back up your registry settings using File > Export… in the Registry Editor window.

  1. Open the Registry Editor and navigate to the following path. Alternatively, you can paste the following path into the address bar of the Registry Editor window and press the Enter key to get to that location.
    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
  2. Right-click an empty area in the right-hand pane and select New > DOWRD (32-bit) Value.create a new dword entry in registry editor
  3. When the new DWORD file is created, name it “MaxCacheTtl“.max ttl dword entry registry editor
  4. Now, right-click MaxCacheTtl and select Modify to edit its properties.
  5. Change the Value data to 86400 or 172800 (seconds) to clear the DNS cache automatically every 24 or 48 hours respectively. You can set this value as per your preference. Click on the OK button to save the changes.change max ttl value data in registry editor
  6. Now, right-click an empty area again and select New > DOWRD (32-bit) Value.
  7. This time, name this new file MaxNegativeCacheTtl.create max negative cache ttl dword entry in registry editor
  8. Double-click MaxNegativeCacheTtl, modify its Value data to 5, and click OK to save the changes.change max negative cache ttl value data in registry editor

You have successfully scheduled the automatic DNS flush on your Windows computer every 24 or 48 hours.

6. Stop DNS from Heaping up via Control Panel

Using this bonus tip, you can configure your Windows PC so the DNS cache doesn’t overpopulate. This way, you can avoid issues caused by the DNS dump.

  1. Open the Control Panel.
  2. Click Network and Internet > Network and Sharing Center.
  3. On the left-hand side of the window, click Change adapter settings.network and sharing settings center in windows
  4. Right-click your active network connection and select Properties.network connection settings windows 11
  5. Select Internet Protocol Version 4 (TCP/IPv4) from the list of items and click Properties.ethernet properties windows 11
  6. Under General, check the box next to Obtain an IP address automatically and uncheck the box next to Use the following DNS server addresses.internet protocol version 4 properties windows 11
  7. Click OK to save your changes.
  8. Close the Control Panel window and restart your computer for the changes to take effect.

We hope this article helped you understand what flushing DNS means and how to do it quickly and effectively in Windows 10 and 11. Now that you’ve learned how to flush your cache, take some time to explore how to clear browser cache and cookies in Chrome, Edge, Opera, and Firefox web browsers.

Was this Article helpful?
YesNo