Is a stale DNS cache making your web browsing experience excruciatingly slow? If so, you may have thought about speeding things up by switching to an alternate domain name server on your device. In that case, you’ll need to clear the DNS cache on your device. There are several ways to go about flushing DNS caches in iOS and macOS, and this step-by-step tutorial covers them all! Here’s how to delete the DNS cache on your iPhone, iPad and Mac.
If you cannot connect to some websites, a web page won’t load at all or your network slows down randomly for no apparent reason, chances are your device’s DNS cache has become corrupted due to technical glitches, administrative accidents or other reasons.
Aside from other reasons, the DNS cache may become polluted when unauthorized domain names or IP addresses are inserted into it via a network attack or malware/virus.
But worry not, resetting the DNS cache should help resolve those problems.
What is a DNS cache?
DNS, or “Domain Name System,” has been the staple of the Internet’s functionality since 1985.
In short, DNS is a decentralized naming system for devices connected to the Internet or a private network (VPN). The system assigns domain names to each of the devices while translating human-readable domain names like iDownloadBlog.com to the numerical IP addresses that identify services and devices with the underlying network protocols.
A DNS cache, also known as a DNS resolver cache, is a temporary database, a phone book of sorts, which helps speed up DNS lookups by storing records of all the recent network requests. Rather than having to memorize numerical IP addresses for your favorite websites, your device can tap into a cached table of recent DNS lookups to know how to load a web resource.
In other words, a DNS cache is just a memory of recent DNS lookups that your computer can quickly refer to when it’s trying to figure out how to load a website. A DNS cache is maintained by the operating system but some browsers may keep their own DNS cache.
All caches can become corrupt over time, and that’s especially true with DNS ones. A corrupt DNS cache may lead to intermittent problems with loading websites. Ergo, clearing the DNS cache so it doesn’t hold invalid items is usually the best way to solve any such woes.
It is very important to stress that clearing the DNS cache won’t remove your browsing history, website data, saved passwords or any other temporary Internet files that get saved to your device to speed up web page load times.
When and why you should clear DNS caches
Here are a few common scenarios in which clear the DNS cache may help.
Prevent DNS hijacking: This practice subverts the resolution of DNS queries, which can be achieved via malware or by modifying the behavior of a trusted DNS server to the point it no longer complies with Internet standards. Flushing your DNS cache minimizes risk of DNS hijacking, which is a significant problem in China.
Resolve page-loading problems: Starting fresh is the best way of addressing situations when some websites won’t load or web pages load slowly.
Server entires have changed: If an entry on the web server is changed or a new entry is added, you might need to flush the DNS cache immediately to prevent interruptions. Keep in mind that if you’re waiting for server-side DNS changes to propagate, adjusting your device’s DNS settings may not have a desired effect before the changes have carried over between servers around the world.
Using Google DNS or Open DNS servers: Before setting your device to use Google DNS or Open DNS servers as its DNS, which speeds up web browsing when on Wi-Fi, you’re advised to flush out the DHCP assignments by clearing out DNS caches.
Enforce a network settings change: If you’ve made changes to your device’s network settings, like adding a custom DNS as part of your VPN service, clearing out the DNS cache will make these changes take effect immediately without any further action.
Protect from malware: A computer virus or malware may change your DNS settings in the background, or fool you into changing them manually, in order to redirect you to a page full of ads or a phishing page that mimics a legitimate website. Clearing out the DNS cache deletes all the entries, including invalid or rogue records.
Even if you’re not having any problems loading web pages whatsoever, clearing out a stale DNS cache won’t just make your web browsing experience hassle-free but will also clean up the valuable storage space in your device.
Your router has a DNS cache, too, meaning that any DNS troubleshooting steps should also include flushing the DNS cache on both the computer and the router.
Follow along with us as we explain how to clear the DNS cache on your iPhone, iPad and Mac.
How to clear DNS caches
You can flush the DNS cache in ways more than one.
How to clear DNS caches on iPhone and iPad
On iOS, you have three different ways of clearing the DNS cache. Firstly, you can toggle Airplane Mode on and then back off, which has the side-effect of flushing the DNS cache. Secondly, you can simply reboot your device in order to achieve the same effect like the Airplane Mode method. And thirdly, dumping your network settings will also do the trick.
Method #1: Airplane Mode
Toggling Airplane Mode is the quickest way to flush your DNS cache because doing so instantly turns off the wireless features on your device and shuts down cellular radios so that you comply with airline regulations. If you need to clear DNS caches multiple times per day, this is the method you’ll want to use (it works with cellular iPads, too).
1) Open Control Center by swiping down from the upper-right corner of the screen on iPhone X or later or iPad with iOS 12 or later. On older devices or iOS versions, swipe up from the bottom edge to pull up the Control Center overlay.
2) Tap the Airplane Mode icon in the top-left corner of the Network Settings card.
When Airplane Mode is toggled on, the icon turns orange to denote that all cellular services are currently shut down, which will also prompt iOS to flush the system’s DNS cache.
3) After about 15 seconds, tap the Airplane Mode icon again to re-enable wireless services.
3) After the device shuts down and turns off, wait a few seconds then press and hold the Side/Top/Power button again until you see the Apple logo. As a security precaution, when the device reboots you’ll need to enter your passcode to re-enable Touch ID or Face ID.
If your device is on iOS 11+, you can also turn it off in Settings → General → Shut Down.
Because rebooting takes more time than toggling the Airplane Mode on and then back off, this isn’t the best approach if you need to flush your DNS cache multiple times per day.
NOTE: Concerned about DNS hijacking? If so, this isn’t the safest method of flushing the DNS cache because the hijacking may occur immediately after the device reboots, before you even have the chance to connect to a VPN.
Method #3: Network settings dump
Clearing the network settings on your device will also flush the system’s DNS cache.
5) Type in your passcode, if asked, then confirm that you wish to clear out all network settings and return them to factory defaults.
This may not be the best method because resetting your network settings won’t just restart the device (which clears the caches anyway) but also clear passwords for all the Wi-Fi networks you’ve joined. Worse, cellular data settings from your wireless provider will be cleared out, too, and all your other network settings will be lost so you’ll need to set them up again.
How to clear DNS caches on your Mac
On macOS, the flushing of DNS caches is performed through Terminal commands that have changed over the years, but don’t you worry a thing as iDownloadBlog has you covered.
1) First, open Terminal from your /Application/Utilities folder or via Spotlight.
You will need to administrative privileges to execute these commands.
Bonus: Mac-cleaning software
If all of the above sounds too complicated, especially the Terminal method, consider a third-party solution such as MacPaw’s CleanMyMac, which is a much simpler alternative to clearing your DNS caches that works on all versions of the Mac operating system.
After you install the app, launch it and click on Maintenance in the lefthand sidebar menu. Now select the option Flush DNS Cache and click Run to have CleanMyMac do its magic.
Clearing DNS caches in Safari, Chrome, Opera & Firefox
In addition to the system’s own DNS cache, most browsers (barring Internet Explorer) also keeps a cached copy of the DNS records. This internal browser DNS cache may get corrupt over time and slow down lookups. Your browser automatically clears its cache when it’s restarted, but you can also do it manually without having to reopen the app.
4) Use the search field at the top to search for “network.dnsCacheExpiration”.
5) Your search should return two variables, named “network.dnsCacheExpiration“ and “network.dnsCacheExpirationGracePeriod”. Double-click on each variable’s value part so you can edit it, then change the value from the default 60 to 0, which will prompt Firefox to immediately clear out its DNS cache.
6) After doing this, now set both variables back to 60.
Restart Firefox for the best resets.
Need help? Ask iDB!
Do you like this how-to?
If so, do pass it along to your support folks and leave a comment below.
Got stuck? Not sure how to do certain things on your Apple device? Let us know via [email protected] and a future tutorial might provide a solution.