Skip to main content
How to Flush DNS Cache

This guide will walk you through the steps to flush the DNS cache on Windows, Mac, and Linux operating systems.

Rapyd Team avatar
Written by Rapyd Team
Updated over a week ago

Clearing the DNS cache on your device can help resolve various networking issues such as website loading errors, DNS resolution problems, or accessing updated versions of websites.

Flushing DNS Cache

This guide will walk you through the steps to flush the DNS cache on Windows, Mac, and Linux operating systems.

Windows

Flushing the DNS cache on Windows requires using the Command Prompt with administrative privileges. Follow these steps:

  1. Press the Windows key, type "cmd", then right-click on Command Prompt and select "Run as administrator".

  2. In the Command Prompt window, type the following command and press Enter:

    ipconfig /flushdns

  3. After executing the command, you should see a message confirming that the DNS Resolver Cache has been successfully flushed.

macOS

To clear the DNS cache on macOS, you'll need to use the Terminal application. Here's how:

  1. Open the Terminal application. You can find it in the Applications folder under Utilities, or you can use Spotlight search (Cmd + Space, then type "Terminal").

  2. In the Terminal window, type the following command and press Enter:

    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

  3. You may be prompted to enter your password. Type it and press Enter (note: when typing the password, you won't see any characters on the screen).

  4. Once the command is executed, the DNS cache will be flushed, and you'll return to the command prompt.

Linux

Linux distributions often use different methods for managing DNS caching, but one common approach is to restart the DNS service. Here's how to do it:

  1. Open a terminal window. You can usually find it in the applications menu or by pressing Ctrl + Alt + T.

  2. Depending on your Linux distribution, you'll need to use one of the following commands to restart the DNS service:

    • For systems using systemd (e.g., Ubuntu 16.04 and newer):

      sudo systemctl restart systemd-resolved

    • For systems using init.d (e.g., older versions of Ubuntu):

      sudo /etc/init.d/nscd restart

  3. After executing the command, the DNS cache will be cleared, and any cached DNS entries will be refreshed.

Conclusion

Flushing the DNS cache can be a useful troubleshooting step when encountering network issues. By following the instructions outlined in this guide, you can easily clear the DNS cache on your Windows, Mac, or Linux system, helping to resolve DNS-related problems and improve network connectivity.

Did this answer your question?