Flushing your local DNS cache clears the stored records that map domain names to IP addresses on your computer. This is useful when a website doesn’t load correctly, shows an old version, or returns a ‘server not found’ error even though the site is up. You’ll need administrator or root access to your operating system, and you’ll use a command-line tool (Command Prompt, Terminal, or PowerShell).
What You’ll Need
- Administrator or root privileges on your computer
- Access to a command-line interface (Command Prompt, Terminal, or PowerShell)
- For Windows: the
ipconfigcommand - For macOS: the
dscacheutilandkillallcommands - For Linux: the
systemd-resolveorresolvectlcommand (depending on your distribution)
Step-by-Step
Windows (all recent versions)
- Press Windows Key + R to open the Run dialog.
- Type
cmdand press Ctrl+Shift+Enter to open Command Prompt as administrator. If prompted by User Account Control, click Yes. - In the Command Prompt window, type the following command and press Enter:
ipconfig /flushdns- You should see the message: Successfully flushed the DNS Resolver Cache.
- Close the Command Prompt window. The cache is now cleared.
macOS (macOS Ventura and earlier)
- Open Finder > Applications > Utilities > Terminal.
- Type the following command and press Enter:
sudo dscacheutil -flushcache- Enter your administrator password when prompted (you won’t see characters as you type).
- Then type this command and press Enter:
sudo killall -HUP mDNSResponder- You won’t see a success message. If no error appears, the cache has been flushed.
Linux (using systemd-resolved)
- Open your terminal (Ctrl+Alt+T on most distributions).
- Check if you’re using systemd-resolved by running:
systemd-resolve --status(orresolvectl statuson newer versions). - If it responds, flush the cache with:
sudo systemd-resolve --flush-caches(orsudo resolvectl flush-caches).- If you use a different DNS resolver (like dnsmasq or nscd), restart that service instead. For example:
sudo systemctl restart dnsmasqorsudo systemctl restart nscd.
Common Mistakes
- Not running as administrator/root: On Windows, if you don’t open Command Prompt as administrator, you’ll get an error like “The requested operation requires elevation.” On macOS/Linux, you’ll get a permission denied error without
sudo. - Using the wrong command for your OS: For example, running
ipconfigon macOS ordscacheutilon Windows will fail. - Typing the command incorrectly: A simple typo like
ipconfig /flushdnsvs.ipconfig /flushdns(missing the slash) will cause an error. - Restarting the wrong service on Linux: If you’re not using systemd-resolved, restarting it won’t clear the cache. Identify your DNS resolver first.
Tips
- After flushing, you can verify the cache is cleared by running
ipconfig /displaydnson Windows (it should show no entries) or by checking the resolver statistics withsystemd-resolve --statisticson Linux (cache size should be 0). - If you’re troubleshooting a specific website, also try clearing your browser cache, as browsers have their own DNS cache.
- Flushing DNS doesn’t harm your system; it just means your computer will need to re-query DNS servers for the next few lookups, which is normal.
- For persistent issues, consider changing your DNS server to a public one (like Google’s 8.8.8.8 or Cloudflare’s 1.1.1.1) to bypass your ISP’s DNS problems.
Troubleshooting
You get an error saying “The requested operation requires elevation” (Windows): Close the Command Prompt and reopen it as administrator (right-click > Run as administrator).
You get “Permission denied” on macOS/Linux: Make sure you prefix the command with sudo and enter your password correctly.
The command runs but you still see old DNS results: This can happen if your router or a proxy server also caches DNS. Try restarting your router, or disable any VPN or proxy temporarily.
On Linux, you get “Command not found” for systemd-resolve: Your distribution may use a different resolver. Try resolvectl (newer systemd) or check if you have dnsmasq or nscd installed. If not, you may need to install one or use sudo /etc/init.d/dnsmasq restart.
You’re on macOS and dscacheutil is not found: This is rare; if it happens, your macOS version might be very old. Try sudo killall -HUP mDNSResponder alone, which works on most versions.
Frequently Asked Questions
How often should I flush my DNS cache?
Only when you’re troubleshooting a DNS-related issue. There’s no need to flush it regularly; the cache automatically expires entries based on their TTL (time-to-live).
Will flushing DNS speed up my internet?
No, it may temporarily slow down browsing because your computer has to re-query DNS servers for every domain. It won’t improve your connection speed.
Does flushing DNS clear my browser history?
No, it only clears the DNS cache on your operating system. Your browser’s history, cookies, and its own DNS cache remain untouched.
Why does a website still show the old IP after flushing?
Your router or an intermediate proxy may also have a DNS cache. Also, the website’s DNS records might have a long TTL, so other DNS servers still have the old info. Wait a few hours or try a different DNS server.
Can I flush DNS on my phone?
Yes, on Android and iOS, you can simply toggle Airplane mode on and off, or restart the device. There’s no built-in command-line method without rooting/jailbreaking.
Is it safe to flush DNS?
Yes, it’s completely safe. It’s a standard troubleshooting step and doesn’t delete any personal data or settings.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Campus Tech Innovation Hubs: What They Are
- Poco C51 Airtel Prepaid Locked Variant India?
- Jenkins vs GitHub Actions: Which CI/CD Fits Your Team?
- Turn Off Backup Encryption in iTunes?
- Shared VPS Hosting: Is It Better?
- Disk Defrag Pro: What It Does and Whether You Need It