How To Flush Your Local DNS Cache

Posted on by Ronald Caldwell | Updated:
Reading Time: 2 minutes

Troubleshooting website issues is a difficult task. You may not know where to start depending on your problems.

If your computer has trouble reaching a particular website or server, this may be due to a corrupt local DNS cache. This guide will show you how to clear or flush your local DNS cache for several operating systems.

Flush Local DNS Cache on Windows

Flushing your local DNS cache on Windows is done via the Command Prompt or Windows PowerShell. The process only requires executing a single command.

Step 1:

Open an elevated command prompt from the Power Users menu by typing the shortcut Windows Key + x. Click Windows PowerShell (Admin).

Step 2:

Input the following command and press Enter.

ipconfig /flushdns

You are shown the following confirmation output.

Successfully flushed the DNS Resolver Cache.

Flush Local DNS Cache on macOS

For macOS, flushing your DNS cache requires running a command in the terminal. There are different commands depending on your version of macOS. To flush your local DNS cache on macOS, launch Terminal and enter the appropriate command for your OS version. You will also input your password for permission to run these commands.

Mac OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra, macOS 10.14 Mojave, and macOS 10.15 Catalina

sudo killall -HUP mDNSResponder

OS X 10.10 Yosemite

sudo discoveryutil udnsflushcaches

OS X 10.7 Lion, 10.8 Mountain Lion, and 10.9 Mavericks

sudo killall -HUP mDNSResponder

OS X 10.6 Snow Leopard

sudo dscacheutil -flushcache

Flush Local DNS Cache on Linux

Many current Linux distributions do not utilize a local DNS resolver cache like Windows and macOS. If you do not know whether your Linux installation is utilizing local DNS caching, please see the website for your Linux distribution and look for information regarding included default software.

Using Name Service Caching Daemon (NSCD) on Linux

Previously, one of the most commonly used Linux applications for DNS caching was Name Service Caching Daemon (NSCD). If you have NSCD installed, you can clear the local DNS cache by running one of the following commands in your favorite terminal or bash shell application. 

Use this command to clear the local DNS cache for the current user.

nscd -i hosts

This command clears the local DNS cache for all users.

nscd -I hosts

Using systemd in Ubuntu-based Linux Distributions

The functionality NSCD provides can be achieved by using systemd-resolved for DNS caching and the System Security Services Daemon (SSSD) for everything else. Use the following systemd command to flush the DNS cache on Ubuntu-based devices. Enter your password upon executing the command to complete the function.

sudo systemd-resolve --flush-caches

Other Ubuntu-based Options on Linux

Some Ubuntu and Debian-derived distributions flush the cache with this command.

sudo service dns-clean restart

Other Options on Linux

Linux distributions that are not Ubuntu-based may use the following command to flush the local DNS cache.

sudo /etc/init.d/dns-clean start

Final Thoughts

Don’t let troubleshooting access to a specific website from your device send you into frustration. Knowing how to flush your local DNS cache is a quick way to determine if the issue is deeper. Use these tools to help determine how far you need to go to fix the problem.

Looking for a managed solution that offers support for these and other issues? Consider Liquid Web’s VPS Hosting, Cloud Dedicated Servers, and Dedicated Servers to provide you with what you need. Our sales team is ready for you to contact them to get started.

Avatar for Ronald Caldwell

About the Author: Ronald Caldwell

Ron is a Technical Writer at Liquid Web working with the Marketing team. He has 9+ years of experience in Technology. He obtained an Associate of Science in Computer Science from Prairie State College in 2015. He is happily married to his high school sweetheart and lives in Michigan with her and their children.

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article