Computers store DNS lookups on the Operating System’s cache. This is good as it helps accelarate network perforamnce, which makes your site load faster.
However, if you are actively designing a website, it also means that changes you make may not immediately reflect. To avoid this behaviour, you may want to clear DNS cache.
How you clear your DNS cache depends on the Operating System you use
To clear DNS cache on various Operating Systems, follow these steps:
Windows 7 or Windows 8 or Windows 10 #
To clear your DNS cache if you use Windows 7 or 10, perform the following steps:
- Click Start.
- Enter
cmd
in the Start menu search text box. - Right-click Command Prompt and select Run as Administrator.
- Run the following command:
ipconfig /flushdns
Ubuntu 20 or Below #
To clear your DNS cache if you use Ubuntu®, perform the following steps:
- Run the following two commands:
sudo systemd-resolve --flush-caches
sudo systemd-resolve --statistics
Ubuntu 22 #
To clear your DNS cache if you use Ubuntu®, perform the following steps:
- Run the following two commands:
resolvectl flush-caches
resolvectl statistics
Redhat and CentOS, Fedora #
To clear your DNS cache if you use Redhat, Centos and related perform the following steps:
systemctl restart dnsmasq.service
Mac OS 10.10.4 #
To clear your DNS cache if you use macOS X version 10.10.4 or above, perform the following steps:
- Open Terminal
- Run the following command:
sudo killall -HUP mDNSResponder
Mac OS 10.10.1 or Mac OS 10.10.2 or Mac OS 10.10.3 #
To clear your DNS cache if you use the above Mac OS perform the following steps:
- Open Terminal
- Run the following command:
sudo discoveryutil mdnsflushcache
Mac OS 10.7 or Mac OS 10.8 or Mac OS 10.9 #
To clear your DNS cache if you use the above Mac OS perform the following steps:
- Open Terminal
- Run the following command:
sudo killall -HUP mDNSResponder
Mac OS 10.5 or 10.6 #
To clear your DNS cache if you use the above Mac OS perform the following steps:
- Open Terminal
- Run the following command:
sudo dscacheutil -flushcache