Quick Answer: Flushing your flush DNS clears the local database of domain-to-IP address mappings stored on your computer. To do this on Windows, run ipconfig /flushdns in an elevated Command Prompt. On macOS, use dscacheutil -flushcache. On Linux, use resolvectl flush-caches for most modern distributions.
You update your website’s A record, point your domain to a new server, and wait for the propagation to finish. You expect the change to be reflected immediately, but when you visit the site, you see the old version. You try again from a different device, and it works perfectly. That is when you realize the issue isn’t the server, it’s your machine.
Your computer has a list of websites you visited and their addresses. This list is called the DNS cache. It helps your computer work faster. When you open a website, your computer looks at this list first. It does this so it does not have to ask a server for the address every time.
The DNS cache is like a phone book for your computer. When you change your DNS settings, your computer might still use the information in the cache. This means it is not using the information you just put in. This is not something that is broken on your computer.
It is actually working the way it is supposed to. It is not helping you in this case. The DNS cache is still using the information, which is why you might have problems. Your computer and the DNS cache are doing what they are supposed to do. It is causing problems for you because it is using the old DNS settings.
What is a DNS Cache?
The DNS cache is like a list that your computer keeps. This list contains the addresses of websites you visited recently. It is helpful because your computer does not have to check the internet each time you visit a website. The DNS cache stores the addresses so your browser can find them quickly. This makes websites load faster when you visit them. The DNS cache is important because it helps your browser load websites you have been to before.
Comparison of Flush Commands
| Operating System | Primary Command | Access Required |
| Windows | ipconfig /flushdns | Administrator |
| macOS | dscacheutil -flushcache | Standard (Password may be required) |
| Linux (systemd) | resolvectl flush-caches | Root/Sudo |
| Linux (nscd) | systemctl restart nscd | Root/Sudo |
How to Flush DNS Cache on Windows
Windows handles DNS through the DNS Records Checker client service. Flushing this cache requires an elevated Command Prompt.

- Open the Start Menu: Press the Windows key and type cmd.
- Run as Administrator: Do not just click the result. Right-click “Command Prompt” and select “Run as administrator.” This is essential; the command will fail silently without sufficient privileges.
- Execute the Command: In the window that appears, type the following and press Enter:
- DOSipconfig /flushdns
- Confirm the Success: The system will return a message stating, “Successfully flushed the DNS Resolver Cache.”
- Verify: Close the command prompt and attempt to access the resource again.
How to Flush DNS Cache on macOS
Apple’s approach to DNS caching varies across versions, but the commands you use to do things have stayed pretty much the same in newer versions of Apple.
- Open Terminal: Press Command + Space and type “Terminal,” then press Enter.
- Execute the Command: Type the following command and press Enter:
- Bashsudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Enter Password: You will be prompted for your user password. The terminal does not show characters while you type, so just type it and press Enter.
- Wait: The command executes immediately. There is no confirmation message. If you do not see an error, the cache has been cleared.
- Re-test: Return to your browser and refresh the page.
How to Flush DNS Cache on Linux
Linux is fragmented, meaning the method depends on your distribution and the service handling your DNS. Most modern distributions now use systemd-resolved.
- Identify Your Resolver: If you are running Ubuntu, Debian, or Fedora, you likely use systemd-resolved.
- Execute the Flush: Open your terminal and run:
- Bashsudo resolvectl flush-caches
- Verification: You can check the cache status before and after using resolvectl statistics to confirm that the “Current Cache Size” drops to zero.
- Alternative (nscd): If you are on an older system using nscd (Name Service Cache Daemon), run:
- Bashsudo systemctl restart nscd
- This simply restarts the service, effectively dumping the existing cache.
Use Cases: Who Needs to Flush?
The Web Developer:
You are frequently switching your site between a staging environment (local IP) and a production environment (public IP). Without flushing your cache, you might edit the production files while viewing the staging site, which could cause unnecessary confusion.
The Network Administrator:
You have performed a migration or a security update on your infrastructure. You need to verify that your local machines have picked up the new IP records rather than relying on stale configuration data.
The Standard User:
You are trying to access a site that was recently moved or migrated. You see a “404 Not Found” or a “Site Under Construction” error, while your friends in other locations see the live site. A quick flush is the first step in troubleshooting connectivity issues.
Security and Best Practices
Clearing your DNS cache not only solves connectivity problems; it is also a security hygiene practice.
- Stop Poisoning: DNS cache poisoning is a technique in which an attacker injects fake IP records into your machine’s cache, routing you to a malicious site. Regularly flushing your cache forces your machine to fetch fresh, authenticated records from your actual DNS server.
- Browser Cache: Often, the problem isn’t the OS cache it’s the browser cache. If you flush your OS cache and the site still won’t load, clear your browser’s DNS cache. In Chrome, go to chrome://net-internals/#dns and click “Clear host cache.”
- Use Public Resolvers: If you find you are constantly flushing your cache to fix issues, your ISP’s DNS servers might be unreliable or slow to update. Consider switching to a public, high-availability resolver like 1.1.1.1 or 8.8.8.8.
- Automate Periodic Flushes: In server environments where you handle frequent record changes, you can add a cron job to restart your DNS service, though this is rarely necessary on desktop machines.
Troubleshooting DNS Issues
If you have flushed your cache and the issue persists, the problem lies elsewhere.
| Problem | Likely Cause | Fix |
| Site still points to old IP | Browser cache is holding on | Clear browser cache or use Incognito |
| “Flush” command fails | Insufficient permissions | Ensure terminal/CMD is run as admin |
| Changes not reflected globally | Propagation delay | Wait for TTL to expire on upstream servers |
| Intermittent resolution | Host file override | Check C:\Windows\System32\drivers\etc\hosts |
| Still loading wrong site | ISP-level caching | Use a public DNS provider (e.g., Cloudflare) |
Conclusion: Maintaining Your Network Hygiene
When you have problems with a website, and it looks broken or shows incorrect information, the local DNS cache is usually the problem. This is part of how the internet works, and as it gets older, it can make you think you have connection problems. The local DNS cache can cause a lot of trouble when it is not working properly.
- Identify the operating system you are using.
- Open the terminal with administrative or root privileges.
- Run the appropriate flush command for your system.
That said, here is the honest caveat: flushing your cache only clears the “phone book” on your device. If the upstream DNS servers the ones your ISP manages haven’t updated their records yet, flushing your local machine will not help. You will simply have to wait for the Time-To-Live (TTL) values to expire on those servers. If you are a developer, set low TTL values before a migration to avoid this altogether. If you are just a user, perform your flush, restart your browser, and move on. The network will catch up.
Frequently Asked Questions
What actually happens when I flush my DNS cache?
Think of your DNS cache like an address book on your computer. It helps your computer know where websites are, so it doesn’t have to ask the internet every time you click a link. When you flush it, you remove that address book. This makes your computer look up the address for each website you visit. It fixes problems where you might go to a server. Flushing the DNS cache gets you the current website locations. Your computer then has the information to show you the correct websites.
Will flushing my DNS cache delete my browsing history or passwords?
Not at all. Your DNS cache is strictly technical; it only stores the “map” of websites (their IP addresses). It has zero interaction with your cookies, browser history, saved passwords, or personal files. You can run these commands as many times as you want without worrying about losing any of your data or login sessions.
How do I know if my DNS cache is the problem?
You usually won’t see a “DNS error” message; you’ll just see symptoms. If you can’t access a website, but your friends or mobile device can, or if you’ve recently moved your website to a new host and your computer is still showing the old version, your cache is the primary suspect. If the site loads fine on a different device (like your phone) but not on your PC, it’s almost certainly a local cache issue.
Why does my site still show the old version after flushing?
If you have flushed your system cache and the site is still wrong, your browser is likely holding onto its own independent DNS cache. Try closing and fully restarting your browser. If that doesn’t work, clear your browser’s specific cache. If it persists, your ISP (Internet Service Provider) might be aggressively caching the old record, which is unfortunately out of your control and will just require a bit more waiting.
Is it safe to clear my DNS cache?
Absolutely. It is a completely risk-free, standard technical procedure. It doesn’t modify any sensitive system files or change your network settings. It’s effectively just a “refresh” button for your computer’s network navigation. It’s one of the first things IT professionals do when troubleshooting connectivity issues because it carries no downside.
What is the difference between clearing the browser cache and the DNS cache?
It’s helpful to think of them as two different layers. Your browser cache stores actual page content (images, scripts, layouts) to make pages load faster. Your DNS cache stores the “map” (IP addresses) to find those pages. Clearing your browser cache fixes layout or design issues; clearing your DNS cache fixes “site not found” or “wrong site” issues.
Latest Posts