Reading Time: 2 minutes
If your computer has trouble reaching a certain website or server this may be due to a corrupt local DNS cache. This guide will show you how to clear your local DNS cache (“flush” it) for several operating systems.
- First, open an elevated command prompt:
- In Windows 8 and higher, use the keyboard shortcut Windows key + x to access the Power Users menu, then select Command Prompt (Admin).
- In previous Windows versions:
- Type “command” into the search field at the bottom of the Start menu.
- Right-click on the cmd.exe icon.
- Select Run as Administrator.
- Enter the following command and press the Enter key on your keyboard:
- If all goes well, which it should, you will see the following confirmation message:
Successfully flushed the DNS Resolver Cache.
Mac OS X
and enter the appropriate command for your version of OS X, followed by the Enter
key on your keyboard:
- Mac OS X versions 10.10.4 and newer:
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Mac OS X versions 10.10-10.10.3:
sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches
- Mac OS X versions 10.9:
sudo killall -HUP mDNSResponder
- Mac OS X versions 10.6-10.8:
sudo dscacheutil -flushcache
Many current Linux distributions do not utilize a local DNS resolver cache like Windows and Mac OS X. If you do not know whether your Linux installation is utilizing local DNS caching, please see the website for your Linux distribution and look for information regarding default included software.
- One of the most commonly used DNS caching Linux applications is NSCD (Name Service Caching Daemon). If you have NSCD installed, you can clear the local DNS cache by running one of the following commands in your favorite terminal/shell application:
- To clear local DNS cache for current user:
nscd -i hosts
- To clear local DNS cache for all users:
nscd -I hosts
- Some Ubuntu and Debian-derived distributions can flush the cache with:
sudo service dns-clean restart
Please see the related articles section below for more information on how you can modify your local hosts file, update DNS records, and learn more about the theory behind DNS.