Free Guide to Clearing DNS Cache on Windows, Mac, and Linux
What Is DNS Cache and Why It Matters DNS stands for Domain Name System. Think of it as a phone book for the internet. When you type a website address like "w...
What Is DNS Cache and Why It Matters
DNS stands for Domain Name System. Think of it as a phone book for the internet. When you type a website address like "www.example.com" into your browser, your computer needs to find the actual server where that website lives. That server has a numerical address called an IP address, which looks something like 192.0.2.1. Your computer uses DNS to translate the website name into that number.
Your operating system keeps a record of recently visited websites and their IP addresses. This record is called the DNS cache. The purpose of caching is speed. Instead of asking a DNS server every single time you visit a website, your computer can look up the address in its local cache first. This process typically takes milliseconds instead of seconds, making your browsing experience faster.
However, DNS cache can sometimes contain outdated information. A website might move to a new server, but your computer's cache still points to the old location. This causes problems like websites not loading, connection errors, or reaching the wrong website entirely. Additionally, clearing DNS cache can help resolve connectivity issues, improve security by removing cached malicious addresses, and refresh your computer's internet connection.
DNS cache exists on every device that connects to the internet. Windows computers, Mac computers, and Linux systems all maintain their own DNS caches. The process of clearing this cache differs slightly on each operating system because they use different methods to store and manage the data.
Practical Takeaway: If you're experiencing website loading issues, seeing error pages for sites that should work, or notice your internet connection acting strangely, clearing your DNS cache may resolve the problem without needing technical support.
How to Clear DNS Cache on Windows 10 and Windows 11
Windows computers store DNS cache information in system memory. The most straightforward method to clear this cache involves using the Command Prompt, which is a built-in Windows tool. This method works on Windows 10, Windows 11, and most other recent Windows versions.
To begin, you need to open Command Prompt with administrator privileges. Click the Windows Start button and type "cmd" or "command prompt" in the search box. Right-click on "Command Prompt" when it appears in the search results and select "Run as Administrator." Your computer will ask for permission to make changes. Click "Yes" to continue. You should now see a dark window with white text where you can type commands.
Once Command Prompt is open, type the following command exactly: ipconfig /flushdns and then press Enter. The letters and characters are important, so type them carefully. Your computer will process the command, and you should see a message saying "Successfully flushed the DNS Resolver Cache." This message confirms that your DNS cache has been cleared. The entire process typically takes less than one minute.
If you prefer using the graphical interface instead of typing commands, Windows also offers another option. You can access the Network Settings menu by right-clicking the network icon in your system tray (bottom right corner) and selecting "Network and Internet Settings." From there, navigate to "Advanced Network Settings" and then "More Network Options." However, this graphical method does not directly clear DNS cache; it only shows you connection information. The command prompt method remains the most direct approach.
Some users may need to clear additional caches for maximum effectiveness. Your internet browser also maintains its own separate cache of website information. Chrome, Firefox, Edge, and Safari each have their own cache clearing options found in their settings menus. Clearing your browser cache separately from your DNS cache can resolve more comprehensive connectivity and loading issues.
Practical Takeaway: Windows users should use the command ipconfig /flushdns in an Administrator Command Prompt window. This single command clears all cached DNS records on your computer and typically solves loading issues within seconds.
How to Clear DNS Cache on macOS and Mac Computers
Mac computers running macOS operate differently from Windows computers. The method for clearing DNS cache on a Mac depends on which version of macOS you're running, as Apple changed the process in different versions. Fortunately, the most current method works on recent Mac computers running macOS versions from the last several years.
First, you need to access Terminal, which is Mac's version of Command Prompt. Open Finder and navigate to the Applications folder. Inside Applications, find the Utilities folder and open it. Look for Terminal in the Utilities folder and double-click it to open. Alternatively, you can press Command + Space to open Spotlight Search, type "terminal," and press Enter. Terminal appears as a black window with white text, similar to Windows Command Prompt.
For Macs running macOS 10.11 (El Capitan) or later, which includes most modern Mac computers, type the following command: sudo dscacheutil -flushcache and press Enter. Your computer may ask you to enter your password. Type your computer's password (the one you use to log in) and press Enter again. Even though you type your password, it will not appear on screen for security reasons. Your computer will process the command silently, meaning you won't see a confirmation message. This is normal. The DNS cache has been cleared successfully.
If you want a visual confirmation, use this alternative command instead: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press Enter. This command clears the cache and restarts the DNS service. You may see your computer briefly show a brief notification or momentary network interruption. Both commands produce the same result; the second one simply provides visual feedback that the process completed.
For older Mac computers running macOS versions before 10.11, different commands apply. If you use an older Mac, you might need to use sudo killall -HUP mDNSResponder or dscacheutil -flushcache instead. Most users with modern Macs will use the first command mentioned above.
Practical Takeaway: Mac users should open Terminal and enter sudo dscacheutil -flushcache, then type their password when prompted. This clears the DNS cache on modern Mac computers without requiring a restart.
How to Clear DNS Cache on Linux Systems
Linux systems handle DNS caching differently from Windows and Mac computers. Linux itself does not maintain a system-wide DNS cache by default. Instead, Linux relies on a service called systemd-resolved to manage DNS queries on many modern distributions. However, some Linux systems use alternative DNS caching services like dnsmasq or BIND. The clearing process depends on which service your specific Linux distribution uses.
For most modern Linux distributions that use systemd-resolved (including Ubuntu 18.04 and later, Fedora, Arch Linux, and others), clearing the DNS cache involves opening a Terminal window and entering: sudo systemctl restart systemd-resolved and pressing Enter. You'll be asked to enter your password. Type it and press Enter. This command restarts the DNS resolution service, effectively clearing its cache. Some distributions may also respond to: sudo resolvectl flush-caches which explicitly flushes DNS caches without requiring a full service restart.
Linux users can verify whether their system uses systemd-resolved by opening Terminal and typing: systemctl is-active systemd-resolved and pressing Enter. If the response says "active," your system uses systemd-resolved. If it says "inactive," your system uses a different DNS caching service, and you'll need a different approach.
For systems running older versions of Linux or alternative DNS services, you may need different commands. If your system uses dnsmasq (common on some desktop Linux distributions), you would use: sudo systemctl restart dnsmasq. If your system uses BIND, the command would be: sudo systemctl restart named or sudo rndc flush. Running the command to check your system's DNS service first prevents errors from using wrong commands.
Linux users should note that clearing DNS cache on Linux rarely needs to happen because Linux doesn't cache DNS the same way Windows and Mac do. However, restarting the DNS service can help resolve certain network connectivity problems, particularly when you've changed DNS servers or experienced network outages.
Practical Takeaway: Most Linux users should open Terminal and
Related Guides
More guides on the way
Browse our full collection of free guides on topics that matter.
Browse All Guides โ