Flushing your computer's DNS cache can help resolve website browsing issues. This guide will show you how to do it on both Windows and macOS.
Understanding DNS Cache
When DNS changes are made, they occur instantly on our nameservers. However, it may be some time before your computer (or your customer's computers) see the changes. This is because every DNS record has something called a Time To Live (TTL) value. The TTL tells other DNS servers how long to cache a DNS record for before refreshing their local data.
Normally DNS records are set with a TTL value of 14400 (4 hours), but some DNS records have a 24 hour TTL value (86400) so it can take up to a day to see the changes take effect.
The TTL delay is compounded by the fact that your operating system (Windows and macOS) both cache DNS data to reduce the number of requests they make to your ISP. On top of that, web browsers also create a local cache. And, if you have a broadband router (or modem/router) it's likely that will be where your local devices request DNS lookup from - and that may be caching the responses too.
Quick and Thorough Method
Turn it off and on again! Simply powering down your router/modem and shutting down your device(s) for a few minutes and then restarting them will cause them to start up with a clear DNS cache. This method often works, but can still be subject to any DNS proxy your ISP may have in place - which may cause your router to continue to pick up the old address until your ISP's cache entries get refreshed.
You can get around using your ISP's DNS servers by setting your device to use third-party servers like those provided by Cloudflare (18.104.22.168 and 22.214.171.124) or Google (126.96.36.199 and 188.8.131.52). Most modern routers allow you to set the DNS servers provided to devices on your local network - so setting these on the router means you won't have to reconfigure each device.
Using the 184.108.40.206 Service
Another easy method to flush your DNS cache is to use the 220.127.116.11 service. Cloudflare provides this service as a public DNS resolver that provides faster and more secure internet browsing. By changing your DNS settings to use the 18.104.22.168 service, you can ensure that your DNS cache is always up-to-date.
Specific Instructions for Clearing Your Device's DNS Cache
- Open the Command Prompt by either clicking the Start button and typing CMD and then pressing Enter, or clicking the Start button and scrolling to the Windows System folder - left-click to open the folder and then left-click Command Prompt.
- Type the following command and press Enter:
- If the command runs successfully you'll see a message similar to this:
Successfully flushed the DNS Resolver Cache
Open the Terminal application from the Applications/Utilities folder or search for it using Spotlight.
Depending on which version of Mac OSX you are running, you should type in the appropriate command and press Enter:
- For Mac OS X prior to 10.5.1 (Leopard):
sudo lookupd -flushcache
- Mac OS X 10.5 and 10.6 (Leopard and Snow Leopard):
sudo dscacheutil -flushcache
- Mac OS X 10.7, OS X 10.8 and OS X 10.9 (Lion, Mountain Lion & Mavericks):
sudo killall -HUP mDNSResponder
- OS X 10.10, 10.10.1, 10.10.2 and 10.10.3 (Yosemite):
sudo discoveryutil mdnsflushcache
- OS X 10.10.4 and onwards (Yosemite & El Capitan, Sierra,High Sierra, Mojave, Catalina, Big Sur, Monterey):
sudo killall -HUP mDNSResponder