Home domains Dns: how to clear the local dns cache

Dns: how to clear the local dns cache

Last updated on Aug 05, 2025

How to Clear DNS Cache on Different Operating Systems

Clearing the DNS cache can help resolve issues like slow internet or incorrect domain resolutions. Below are step-by-step instructions for clearing the DNS cache on various operating systems.


Introduction

DNS (Domain Name System) cache stores information about domain names and their corresponding IP addresses. Over time, this cache can become outdated or corrupted, leading to issues like slow internet speeds or incorrect domain resolutions. Clearing the DNS cache can help restore proper network functionality.


macOS

On macOS Monterey (and newer), you can flush the DNS cache using the following command:

  1. Open Terminal: Open your terminal application.
  2. Flush DNS Cache: Run the command:
    sudo networksetup flushDNS
    
  3. This will clear the DNS cache on your system.

Note: After clearing the cache, test your internet connection to ensure it resolves correctly.


Linux

On Linux, there are multiple ways to clear the DNS cache:

Method 1: Using NSCD

  • Restart the NSCD service:
    sudo /etc/init.d/nscd restart
    
  • This will flush the DNS cache on your system.

Verification: Check if the cache is cleared by running:

sudo nslookup google.com

Look for "Server: 10.100.0.1" to confirm flushing.

Method 2: Using systemd-resolve

  • Flush the cache with:
    sudo systemd-resolve --flush-caches
    
  • Verify cache status by running:
    sudo systemd-resolve --statistics
    
    Look for "Current Cache Size" to confirm flushing.

Windows

On Windows, you can clear the DNS cache using the ipconfig command:

  1. Open Command Prompt:
    • For Windows 10/11: Right-click on the Start button and select "Command Prompt".
    • For earlier versions, click "All Programs > Accessories > Command Prompt" and run as Administrator.
  2. Flush DNS Cache: Enter the following command:
    ipconfig /flushdns
    
  3. This will clear your system's DNS cache.

Additional Notes

  • After clearing the cache, test your internet connection to ensure it resolves correctly.
  • If issues persist, contact your network administrator or check if any cached data is needed for specific applications.