Caches are incredibly useful tools for optimising a user’s website browsing experiences. Why? Well, they store often-accessed data in a memory location that can be accessed more quickly than always returning the access request to the server.
That means faster website loading times, as a device can store a local copy, so the site data (or content) requested by the browser can be retrieved and displayed more quickly on subsequent visits.
But caching isn’t without its downsides. Various information can become outdated and cause connection issues, come under threat from attack, or make it easier for hackers to track online behaviours. This is where flushing your DNS cache comes in. If you aren’t sure how to flush DNS, don’t worry – this is your complete guide.
What is a DNS Cache?
Your Domain Name System (DNS) translates the domain name of a website into a corresponding IP address, so the browser knows where to direct you.
You can read our full explainer on DNS here.
A DNS cache, therefore, is a temporary store within your operating system of previous DNS lookups. It contains several components (which you’ll be able to find within the DNS Zone editor).
These are:
- Record Name: a DNS entry’s domain name
- Record Type: a DNS entry’s record type, which will be either A or AAAA
- Resource data: a DNS entry’s description, containing the address and hostname
- Resource data length: refers to the resource data’s value
- Class: the protocol group of your resource record
- Time to live (TTL): the length of time (in seconds) that the record is valid for
Do you need to flush your DNS?
Most of the time, you don’t have to worry about flushing your DNS cache. That’s because your DNS cache will automatically renew itself based on the TTL, refreshing the data it has stored to ensure that its cached results aren’t out of date. Plus, if you reboot the DNS server at any time, your DNS cache will automatically clear.
Although a DNS cache reduces load times for frequently visited sites, flushing the DNS won’t have a hugely noticeable impact on your overall internet browsing speed. So, should you find yourself needing to flush the DNS, you should do so in the confidence that it won’t adversely affect your browsing experience.
As some issues can occur before the TTL is up, there are a few situations in which learning how to flush DNS can be beneficial. Manually flushing the DNS cache will force the cache to clear, so you’ll be able to access just the live sites, rather than your stored version.
One hosting platform for your agency.
Our platform was designed with your needs in mind, which means it’s easy to use, and time-saving too.When to flush the DNS
While there’s not usually a need to worry about making the DNS change yourself, there are a few situations that might prompt you to flush the DNS record manually.
If you’re experiencing one of the following, you might want to consider a DNS cache flush:
1 Seeing a 404 error
404 errors – ‘page not found’ – occur when a browser can successfully communicate with a server, but that server has not been able to locate the requested page or file.
In the case of DNS caching, this may be because the live version of the site no longer matches the cached version stored on your device. Perhaps it has moved to a new domain name, or changed web host.
After a while, this kind of error will seem to solve itself, as the information stored within your DNS cache is updated. However, by flushing your DNS cache, you don’t have to wait for this update to happen.
2 Wanting to browse in private
DNS caching can be understood to be a form of tracking – it reveals your search history with its list of saved information from the sites you’re regularly visiting. Of course, this tracking is in place to speed up your experience on websites you regularly visit.
Still, learning how to flush the DNS, and doing so regularly, can keep this kind of information private – and stop data collectors from being able to track your habits via your cached sites.
3 Preventing DNS spoofing
Also known as DNS cache poisoning, DNS spoofing describes the act of putting false information into the DNS cache. It’s a particularly malicious attack, as it allows the attacker to divert traffic from a legitimate DNS server to a fake one.
By redirecting the data in DNS servers to their IP address, users become at risk of phishing attacks. Sites that are created to resemble the real one can be used to farm sensitive information, as users are prompted to log in to their accounts, and their credentials are stolen. In the case of financial information, like online banking passwords, this can result in significant losses.
How to flush DNS cache
Different operating systems have different ways of flushing the DNS cache. In these step-by-step guides, we’ll explain flushing DNS servers on all common operating systems – and a couple of browsers, too (which you should do in conjunction if you regularly use them).
How to flush the DNS in Microsoft Windows XP, 7, Vista, 8, 8.1 or 10.
The process for flushing the DNS in Windows is largely similar across most versions. To begin, you’ll have to use the ‘run as administrator’ option during the command prompt to access the system security permissions you’ll need. This may require the administrative login and password of whoever owns the Windows machine you’re using.
- Use the Windows + R shortcut to open the ‘Run’ window
- Type ‘cmd’ to open Windows Command Prompt
- Type the following command prompt, and press ‘Enter’: ipconfig /flushdns
How to flush the DNS in Mac OS X.
The command prompt you’ll need to run on Mac OS X differs depending on which software version your Mac is running. (You can find out which command prompt you need by clicking the Apple icon in the top left corner, followed by ‘About this Mac’.)
- Open ‘Finder’, and click ‘Applications’
- Open ‘Terminal’ within the ‘Utilities’ folder
- Type in the following command prompt (depending on which macOS you’re running):
- 0.7-10.9, 10.11-10.14 (Lion, Mountain Lion, Mavericks, El Capitan, Sierra, High Sierra, Mojave): sudo killall -HUP mDNSResponder
- 11 (Big Sur) or 12 (Monterey): sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- 10.10 (Yosemite): sudo discoveryutil mdnsflushcache
- 10.5-10.6 (Leopard, Snow Leopard): sudo dscacheutil -flushcache
- 10.4 (Tiger): lookupd -flushcache
- Enter your password, and press ‘Enter’
How to flush the DNS in Linux.
Linux is a popular operating system – and the one which powers Android devices. It doesn’t cache DNS records by default, but you can choose to manually install a DNS service – which you’ll then have to access via the ‘Terminal’ application (Ctrl + Alt + T) to flush.
- Once you’ve opened the ‘Terminal’ window, type in one of the following command prompts (depending on which service your Linux system is using):
- NCSD: sudo /etc/init.d/nscd restart
- Dnsmasq: sudo /etc/init.d/dnsmasq restart
- BIND: You may have to try multiple commands:
-
-
- sudo /etc/init.d/named restart
-
-
-
- sudo rndc restart
-
-
-
- sudo rndc exec
-
- Systemd: systemd-resolve –flush-caches
- You may be prompted to enter your password before the reset occurs
How to flush DNS in your browser
Flushing the DNS resolver cache in your browser is very similar to doing so on your operating system, although each operating system is a little different and requires a different prompt.
Each browser also has a different journey to access the DNS cache. Some can be accessed from the browser’s address bar, others require going into the menu system. All require an internet connection and system administrator access, though.
How to flush the DNS in Google Chrome.
Although Google Chrome is not itself an operating system, it does keep its own DNS cache, which means that if you regularly use it – or have it as your default browser – it’s worth flushing its separate DNS cache along with other DNS records. To clear Chrome’s DNS cache, just follow the instructions below.
- Navigate to this address via your browser: chrome://net-internals/#dns
- Click the ‘Clear host cache’ button
How to flush the DNS in Firefox.
If Firefox is your default browser, learning how to DNS flush is even easier, as the cache is not kept on the disk, therefore it’s as simple as just restarting your browser. However, if you’d prefer not to restart your browser, you can follow similar steps to the Google Chrome process:
- Navigate to this address via your browser: about:networking#dns
- Click the ‘Clear DNS Cache’ button
How to flush the DNS in Microsoft Edge.
There are two different ways to flush the DNS if Microsoft Edge is your default browser – depending on whether you use Edge Chromium or the Edge legacy browser.
What does flushing the DNS do?
Once your DNS cache has been successfully flushed, you’ll be effectively starting from scratch when you visit each website.
That means that load times may be slightly longer at first – but don’t worry, the cache will begin to fill again once you get back to browsing, so you’ll soon be back to normal. And you likely won’t notice a difference in the short term.
And if a client reports trouble viewing an updated version of their site, guiding them through the process of flushing the DNS should help get things back to running smoothly.