How To Flush DNS and Reset TCP/IP with ipconfig /flushdns Command In Windows
DNS is used to translate between a human-readable name like
poftut.com and IP address like
45.79.1333.118. DNS can use both UDP and TCP protocols but generally, UDP protocol is preferred. In this tutorial, we will learn how to flush, clear the DNS cache with
ipconfig /flushdns command. This tutorial can be applied to the All Windows Operating system versions like Windows XP, Windows 7, Windows 8, Windows 10, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows Server 2016, Windows Server 2019 without a problem. This will not require special privileges like Administrator.
For every domain name, DNS will query to the DNS Server normally. But this may create a bottleneck in busy times. In order to prevent this bottleneck, DNS services use cache mechanism. Learned DNS records are stored in a cache for some time. If during this period a DNS is queried cache returns if exists.
Print and List Current DNS Cache Entries
We can print or list currently cached DNS entries with the
/displaydns option of
> ipconfig /displaydns
As we can see from screenshot domain names are stored in DNS cache with related information. There is the following information
- Record Name specifies the name of the DNS record
- Record Type specifies the type of DNS entry
- Time To Live provides the validity time of the DNS entry
- Data Length
Flush DNS Entries with ipconfig /flushdns Command
In order to clear this DNS cache, we will use
ipconfig command with
/flushdns parameter. This will remove all DNS entries except
localhost because it is a local system DNS record.
> ipconfig /flushdns
We can see that flush is completed successfully from the screenshot.
In the previous example, we have used a command line which is named
cmd.exe. We can also run
ipconfig /flushdns command from
Run like below. This will open a command line and run the command to clear and delete all DNS cache entries. Then the command line will be closed automatically.
Check DNS Cache Entries Whether Flushed
We can check whether flush is effective with the
ipconfig /displaydns command again like below.
> ipconfig /displaydns
As we can see other DNS entries are deleted successfully. There are only
arpa DNS entries which are static.
Flush DNS with PowerShell
PowerShell provides very same of the traditional MS-DOS commands. We can use all of the MS-DOS commands in PowerShell too. We can flush the DNS cache records with the
ipconfig /flushdns command like below. First, we will open PowerShell from the start menu by writing
powershell like below.
Then we will type the command like below.
PS> ipconfig /flushdns
Flush DNS with PowerShell Clear-DnsClientCache Cmdlet
Powershell provides a new way to clear DNS client cache or flush DNS with the
Clear-DnsClientCache cmdlet. We will just execute the command like below.