How to Clear Your DNS Cache (Windows, Mac, and Linux)
A step-by-step guide on how to clear DNS cache and resolve common internet connectivity issues. If you are experiencing slow loading pages, incorrect website redirects, or are unable to access certain websites despite having a stable internet connection, the solution may be quite simple. You probably need to clear DNS cache stored on your device.
We’ll explain what DNS cache is, why you should clear it, and provide step-by-step instructions for Windows, Mac, and Linux systems.
What Is DNS Cache?
DNS stands for Domain Name System. It’s like the internet’s address book, translating human-readable domain names such as yoursite.com, into machine-readable IP addresses that computers use to communicate with one another.
When you visit a website, your operating system stores a local record of that domain-to-IP mapping. This is known as the DNS cache. The purpose of this cache is to speed up future visits to the same website by eliminating the need for a fresh DNS lookup each time you navigate to a familiar address.
Why Should You Clear DNS Cache?
While DNS cache is beneficial under normal circumstances, it can occasionally cause problems. These are the most common reasons to clear DNS cache from your system:
- Outdated records: If a website has moved to a new server with a different IP address, your cached record may still point to the old address, causing the site to fail to load properly.
- DNS poisoning: Hackers can sometimes corrupt DNS cache to redirect users to fraudulent websites. Flushing the cache removes these harmful entries.
- Website errors after migration: After a domain transfer or server migration, certain cache entries can prevent you from seeing the updated version of a site.
- Privacy considerations: DNS cache contains a log of recently visited websites. Clearing it removes this local browsing record from your device.
- General troubleshooting: Many connectivity and access errors are resolved simply by choosing to clear DNS cache entries stored on your operating system.
If a website has moved to a new server with a different IP address, your cached record may still point to the old address, causing the site to fail to load properly.
Hackers can sometimes corrupt DNS cache to redirect users to fraudulent websites. Flushing the cache removes these harmful entries.
After a domain transfer or server migration, certain cache entries can prevent you from seeing the updated version of a site.
DNS cache contains a log of recently visited websites. Clearing it removes this local browsing record from your device.
Many connectivity and access errors are resolved simply by choosing to clear DNS cache entries stored on your operating system.
How to Clear DNS Cache on Windows

Windows stores DNS records through a built-in service called the DNS Client. The most reliable method for how to clear DNS cache on Windows is via Command Prompt or PowerShell.
Method 1: Follow these steps to clear DNS on a Windows 10 or Windows 11 device:
- Press Windows Key + R to open the Run dialogue box.
- Type cmd and press Enter. For elevated access, right-click Command Prompt and select Run as Administrator.
- In the Command Prompt window, type the following command and press Enter: ipconfig /flushdns
- Upon success, Windows will display the confirmation: “Successfully flushed the DNS Resolver Cache.” The process is immediate and requires no system restart.
Method 2: Using PowerShell
- As an alternative, you may use PowerShell to clear DNS cache with the following command: Clear-DnsClientCache
- This command performs the same action as the Command Prompt method and will complete without a confirmation message.
How to Clear DNS Cache on Mac

Apple macOS handles DNS caching differently depending on the operating system version in use. The steps below cover the most widely used versions of macOS.
macOS Monterey, Ventura, Sonoma, and Later
- Open Terminal by navigating to Applications > Utilities > Terminal, or use Spotlight Search (Command + Space) and type “Terminal“.
- Enter the following command and press Return: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- You will be prompted to enter your administrator password. Type it carefully as the characters will not be visible on screen then press Return. No confirmation message will appear on modern macOS versions; the absence of an error indicates the command was successful.
Earlier macOS Versions
- For macOS High Sierra and Sierra, use the following command: sudo killall -HUP mDNSResponder
- For macOS El Capitan and Yosemite, use: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Note: The sudo command requires administrator privileges. Ensure you are logged in to an account with administrator rights before proceeding.
How to Clear DNS Cache on Linux
Unlike Windows or macOS, Linux does not use a single DNS caching system across all distributions. The method for clearing the DNS cache depends on which DNS service your Linux system is running. Below are the most common ways to flush the DNS cache on Linux distributions such as Ubuntu, Debian, CentOS, Fedora, Arch Linux, and others.
Modern versions of Ubuntu and Debian commonly use systemd-resolved for DNS caching.
- To clear the DNS cache, run: sudo systemd-resolve –flush-caches
- On newer Linux versions, you can also use: sudo resolvectl flush-caches
- You can verify the cache was cleared successfully with: resolvectl statistics
Some Red Hat-based distributions use the Name Service Cache Daemon (nscd) to cache DNS queries.
- To clear the DNS cache: sudo systemctl restart nscd
- If nscd is not installed, the command may return an error.
Many lightweight Linux systems and custom server setups use dnsmasq for DNS caching.
- To flush the DNS cache: sudo systemctl restart dnsmasq
- If your Linux server uses BIND as a DNS server, clear the cache with: sudo rndc flush
- This command flushes all cached DNS entries immediately.
- Some desktop Linux distributions manage DNS through NetworkManager.
- Restart the service with: sudo systemctl restart NetworkManager
- This can help refresh DNS settings and clear cached records.
How to Check Which DNS Service Your Linux System Uses
- If you are unsure which DNS caching service is active on your system, run the following command: ps aux | grep -E ‘systemd-resolved|dnsmasq|nscd|named’
- This will display any active DNS-related services running on your Linux machine.
The process to clear DNS cache can be technical but not something too difficult for you to do yourself. It sounds more complicated than it is, so long as you follow the steps it should be quite simple to clear DNS cache from your computer. Once it is clear, then your computer will have smoother connectivity and less troubleshooting issues.
Need further assistance? Get in touch with our team today.