Config Server Firewall

How to Clear DNS Cache Using CMD in Windows

In this guide, I will show you how to flush the DNS cache in Windows using both Command Prompt (CMD) and PowerShell.

Flushing your DNS cache can fix internet connection issues and ensure your computer connects to the most recent version of a website.

Viewing DNS Cache in Command Prompt

To view your current DNS cache, type ipconfig /displaydns and press Enter. This will show you all the websites your computer has recently accessed.

ipconfig /displaydns

Clearing DNS Cache in Command Prompt

To clear the cache, type ipconfig /flushdns and press Enter.

ipconfig /flushdns

To verify that the cache is empty, you can run the ipconfig /displaydns command again. You will see that all the previous entries are gone.

Viewing and Clearing DNS Cache in PowerShell

The ipconfig command works in both CMD and PowerShell, but PowerShell also has its own set of commands.

To view the DNS cache in PowerShell, type:

Get-DnsClientCache

To clear the DNS cache, type:

Clear-DnsClientCache
ipconfig /displaydns
ipconfig /displaydns
Display DNS Cache in Windows PowerShell
Display DNS Cache in Windows PowerShell

That’s how you can view and clear the DNS cache in Windows using both CMD and PowerShell.