How to flush your DNS cache on Windows and Linux

By Angus Published 9 January 2025 Updated 8 October 2026 3 min read
Quick answer

On Windows, open Command Prompt and run ipconfig /flushdns. A message saying the DNS Resolver Cache was flushed confirms it worked. On Ubuntu 24.04, run sudo resolvectl flush-caches in a terminal, then resolvectl statistics to confirm the cache size is zero. Clear your browser cache as well to remove any outdated records it still holds.

Your device stores DNS information for recently visited sites in a temporary cache. This speeds up browsing by reducing queries to external DNS servers. When DNS records change, your cached information becomes outdated and causes loading problems.

You will clear your DNS cache to force your device to fetch current DNS records. This fixes loading issues during website development when DNS changes happen frequently.

Before you begin

  • You need administrator access on Windows or sudo privileges on Linux.
  • We recommend clearing your browser cache after flushing DNS to remove all outdated records.

Flush DNS cache on Windows 11

Windows stores DNS records in a resolver cache. You will use the command prompt to clear this cache and force Windows to query DNS servers for fresh records.

  1. Open the Start menu.

Press the Windows key on your keyboard or click the Start button in the taskbar.

  1. Search for Command Prompt.

Type command prompt in the search box. Click Command Prompt when it appears in the results.

Searching for Command Prompt in the Windows 11 Start menu.

  1. Run the flush command.

Type ipconfig /flushdns in the command prompt window and press Enter. This clears all DNS records stored in your local cache.

  1. Confirm the cache was cleared.

You will see the message “Successfully flushed the DNS Resolver Cache” confirming the operation completed.

Successful DNS cache flush in Windows Command Prompt.

Your Windows DNS cache is now empty. Your device will fetch current DNS records the next time you visit a website.

Flush DNS cache on Ubuntu 24.04

Ubuntu uses systemd-resolved to manage DNS caching. You will run a command in the terminal to clear cached records and verify the operation completed.

  1. Open a terminal window.

Press Ctrl+Alt+T or search for Terminal in your applications menu.

  1. Run the flush command.

Type sudo resolvectl flush-caches and press Enter. This clears all DNS records stored by systemd-resolved.

  1. Enter your password.

Type your account password when prompted and press Enter. The command runs with administrator privileges.

  1. Verify the cache was cleared.

Run resolvectl statistics to display cache statistics. The current cache size should show zero entries.

Your Ubuntu DNS cache is now cleared. The system will query DNS servers for fresh records on your next request.

Wrapping up

You cleared your DNS cache to remove outdated DNS records. Your device now fetches current information from DNS servers, fixing loading problems caused by stale cache entries.

Clear your browser cache after flushing DNS to remove all locally stored records. If your site still does not load correctly, check our guide on why you cannot access your site. Our cloud hosting platform handles DNS propagation automatically when you update records.

Did this guide solve your problem?

Still stuck?

Our UK support team answers tickets and live chat every day. Send us the guide you were following and where it stopped working.

Open a ticket

Keep learning

Hosting that keeps up

cPanel hosting with the tools these guides use, backed by UK support.

Get cPanel Hosting

Keep your site secure

Protect your visitors with SSL certificates – from budget DV to premium EV certificates.

Get SSL Certificate
Back to top