How to flush DNS cache on Windows, Mac, and Linux

Your computer stores DNS records locally so websites load faster on repeat visits. When a site moves to a new server or you change your domain’s DNS, your cached records may still point to the old address. Flushing the DNS cache clears these stored entries and forces your computer to fetch fresh DNS data. In particular, this often fixes “site not found” or “connection refused” errors after migrating a website or updating DNS.

Flush DNS on Windows

On Windows 7, 8, 10, and 11, open Command Prompt or PowerShell as Administrator and run:

ipconfig /flushdns

You should see: “Successfully flushed the DNS Resolver Cache.” If you don’t have admin rights, right-click Command Prompt and select “Run as administrator.”

Flush DNS on macOS

Open Terminal (Applications → Utilities → Terminal) and run the command for your macOS version. You’ll need your administrator password.

macOS 10.10.4 and later (including Monterey, Ventura, Sonoma):

sudo killall -HUP mDNSResponder

macOS 10.10.1 to 10.10.3:

sudo discoveryutil mdnsflushcache

macOS 10.5 and 10.6:

sudo dscacheutil -flushcache

If you see no error message, the cache was flushed successfully.

Flush DNS on Linux (Ubuntu, Debian)

If you use systemd-resolved (default on Ubuntu 18.04+):

sudo systemd-resolve --flush-caches

On older Ubuntu/Debian versions with nscd:

sudo systemctl restart nscd

If nscd is not installed:

sudo apt-get install nscd
sudo systemctl restart nscd

Flush DNS on Linux (RedHat, CentOS, Fedora)

Restart the nscd service:

sudo systemctl restart nscd

Or use the older service command:

sudo service nscd restart

When to flush DNS cache

Flush your DNS cache when:

  • You’ve migrated your website to a new host or server
  • You’ve updated DNS records for your domain
  • Your site shows a “site not found” or “connection refused” error on your computer but works for others
  • You’re testing DNS changes and want to see the new results immediately

After flushing, your browser will fetch fresh DNS data. Moreover, try closing and reopening your browser or using an incognito/private window to ensure you’re not seeing cached content.

Hosting from JetHost

Need more help?

If you still can’t access your site after flushing DNS, check your knowledgebase for DNS and domain setup guides. For web hosting with reliable DNS support, JetHost offers expert assistance.