How To Flush Or Clear DNS Cache

Commands to flush DNS cache on Windows, Max OSX and Linux.

1 Flush DNS cache on Windows

Run Command Prompt as Administrator, and execute following command:

ipconfig /flushdns

2 Flush DNS cache on Mac OSX

For Mac OSX 10.5 (Leopard) and Mac OSX 10.6 (Snow Leopard):

~$ sudo dscacheutil -flushcache

For Mac OSX 10.7 (Lion), 10.8 (Mountain Lion) and 10.9 (Mavericks):

~$ sudo killall -HUP mDNSResponder

For Mac OSX 10.10.1, 10.10.2, and 10.10.3

~$ sudo discoveryutil mdnsflushcache

For Mac OS X 10.10.4 or later

~$ sudo killall -HUP mDNSResponder

3 Flush DNS cache on Linux

3.1 nscd

If nscd was used on your Linux server, please clear the DNS cache by command line below:

~$ sudo /etc/init.d/nscd restart


~$ sudo service nscd restart

3.2 BIND

Use following command to flush DNS cache of BIND server on your Linux.

~$ sudo /etc/init.d/named restart


~$ sudo service named restart

3.3 dnsmasq

Similarly, restart your dnsmasq service to flush the DNS cache.

~$ sudo /etc/init.d/dnsmasq restart