DNS (Domain Name System) is an essential component of the internet. It acts as a translator between human-readable domain names and IP addresses. The DNS system maintains a cache of recently accessed domain names and their corresponding IP addresses, which speeds up subsequent queries.
However, over time, this cache may become outdated or corrupted, leading to network issues. This guide will explain how to clear the DNS cache on Mac, Windows and Linux.
What is DNS Cache?
A DNS cache is a temporary storage area for recently accessed domain name records. When you visit a website or access any internet service, your computer first checks its local cache for the domain name’s IP address. If it finds a match, it uses that information to connect you with the destination server quickly.
Why Flush DNS Cache?
Sometimes, the cached information becomes outdated or corrupted due to various reasons:
- Websites change their IP addresses.
- Network problems cause incorrect information to be cached.
- Security programs block legitimate access.
In such cases, clearing the cached data can solve many problems related to internet connectivity.
How to flush DNS Cache on Mac
Flushing the DNS cache on Mac OS X involves using the Terminal application:
- Click on Spotlight search icon (magnifying glass) in the top-right corner of your screen.
- Type Terminal and hit enter.
- In Terminal window type
sudo killall -HUP mDNSResponder
and press enter. - Type your admin password when prompted and press enter again.
The command clears both IPv4 and IPv6 resolver caches.
How to flush DNS Cache on Windows

Windows provides a command-line interface to flush the DNS cache:
- Press Windows key + X and select Command Prompt (Admin) from the menu.
- In the Command Prompt window, type
ipconfig /flushdns
and press enter. - Wait for the message “Successfully flushed the DNS Resolver Cache.”
This command only clears the IPv4 resolver cache. If you want to clear the IPv6 cache as well, use this command: ipconfig /flushdns; netsh int ipv6 reset dnsservers
– you will need to reboot your computer if you clear the IPv6 cache also.
How to flush DNS Cache on Linux
Linux has different commands to flush DNS cache depending on the distribution:
Ubuntu/Debian-based distributions:
- Open a Terminal window.
- Type sudo
systemctl restart systemd-resolved.service
and press enter.
Red Hat-based distributions
- Open a Terminal window.
- Type sudo
systemctl restart named.service
and press enter.
Arch Linux
- Open a Terminal window.
- Type sudo
systemctl restart NetworkManager.service
and press enter.
Summary
Clearing DNS cache is an effective solution for resolving many network issues related to domain name resolution. The process of flushing DNS cache is easy and quick, but it varies slightly depending on your operating system or distribution.
With this guide, you can confidently clear your DNS cache in just a few simple steps!