To flush Windows cache, use the netsh winsock reset and ipconfig /flushdns commands in Command Prompt as Administrator. This clears the Windows Sockets (WinSock) catalog and DNS cache, resolving connection errors and improving network responsiveness. These methods also let you clear the system file cache (via disk cleanup) or the Windows Update cache (via net stop wuauserv followed by deletion of the SoftwareDistribution folder). Below are step-by-step methods for each cache type, including troubleshooting common issues.
What You'll Need
- A Windows PC running Windows 7 or later (tested on Windows 10/11; steps may vary slightly with older versions).
- Administrator privileges to run commands in Command Prompt. If you lack these, ask the PC administrator for temporary access.
- Basic familiarity with navigating the Start menu and opening Command Prompt.
- Stable internet connection (for clearing DNS cache) or local access to the drive (for system file cache).
Step-by-Step: Flush Windows Cache Types
Part 1: Clear the DNS Cache (Fastest Fix for Network Errors)
- Open Command Prompt as Administrator: Press Win + X on your keyboard, then select Command Prompt (Admin) or Windows Terminal (Admin) from the menu. If prompted by UAC (User Account Control), click Yes.
- Run the flushdns command:
In the Command Prompt window, type the following exact command and press Enter:
ipconfig /flushdnsYou’ll see a confirmation message: Successfully flushed the DNS Resolver Cache. - Verify the DNS cache is cleared:
Re-run the command
ipconfig /displaydns. If no results appear, the cache is empty. If lines appear, the command did not fully clear the cache, and you may need to restart your PC.
Why This Works
The DNS cache temporarily stores website addresses (like google.com) as IP addresses to speed up future visits. If this cache is corrupted (e.g., due to a bad update or malware), your PC may fail to connect to websites or load them slowly. Flushing it forces Windows to query the DNS server fresh.
Part 2: Reset WinSock and TCP/IP Stack (For Advanced Network Issues)
- In the same Command Prompt (Admin) window, run:
netsh winsock resetWait for the confirmation: Successfully reset the Winsock Catalog. - Next, reset the TCP/IP stack:
netsh int ip resetConfirm with Y when prompted. - Restart your PC to apply changes.
When to Use This
Use these commands if you’re experiencing persistent network issues like:
- Slow or failed internet connections.
- Error messages like "DNS server not responding" or "Network adapter failing."
- Applications (e.g., Skype, Steam) failing to connect to servers.
Part 3: Clear the System File Cache (Free Up Disk Space)
- Open the Start menu and type Disk Cleanup. Press Enter.
- Select the drive you want to clean (usually C:) and wait while Windows calculates free space.
- Click OK when prompted to analyze the drive.
- In the Disk Cleanup window, check these boxes (select all if unsure):
- Temporary files (clears downloaded updates, cache, and temp folders).
- Windows Update Cleanup (removes old update files).
- Previous Windows installations (only if you used Windows Easy Transfer).
Click OK, then Delete Files to confirm.
- Optional: Clear the SoftwareDistribution folder manually (for stubborn updates):
- Open File Explorer and navigate to
C:\Windows\SoftwareDistribution\Download. - Delete all files and folders here (this does not affect active updates).
- Restart your PC to complete the process.
- Open File Explorer and navigate to
Why This Helps
The system file cache stores temporary files for Windows updates, apps, and system processes. Over time, this cache can bloat to hundreds of gigabytes, slowing down your PC and wasting disk space. Clearing it also resolves issues like "Windows Update stuck" or "low disk space" errors.
Part 4: Clear the Windows Update Cache (For Update Errors)
- Open Command Prompt as Administrator again.
- Stop the Windows Update service:
net stop wuauservConfirm with Y. - Rename the SoftwareDistribution folder (this deletes its contents):
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old(The.oldsuffix prevents Windows from recreating it immediately.) - Restart the Windows Update service:
net start wuauserv - Restart your PC to apply changes.
Note
This method is only needed if you encounter errors like "Windows Update failed 0x80070003" or "Update service not running." Otherwise, let Windows manage the cache automatically.
Part 5: Clear the Page File (Virtual Memory) Cache (Advanced)
If your PC is running out of RAM and slowing down, clearing the page file (swap file) cache can help—but this is risky and only recommended for users comfortable with manual system tweaks. Backup your data first.
- Open Control Panel > System and Security > System > Advanced system settings.
- Under Performance, click Settings, then the Advanced tab.
- Click Change under Virtual memory.
- Uncheck Automatically manage paging file size for all drives.
- Select the drive (usually C:) and choose No paging file. Click Set, then OK.
- Restart your PC. Windows will create a new page file at startup.
- Warning: This can cause performance degradation if your RAM is low (<16GB). Only do this if you have at least 16GB RAM and rarely multitask heavily.
Common Mistakes
- Running commands as a standard user:
Many cache-clearing commands (e.g.,
netsh winsock reset) require Administrator privileges. If you skip this step, you’ll see errors like "Access denied" or "Operation failed." - Ignoring the restart requirement: After resetting WinSock or TCP/IP, you must restart your PC. Without a restart, changes may not take effect.
- Deleting the SoftwareDistribution folder without stopping the service:
If you skip
net stop wuauserv, Windows may lock the folder, preventing you from deleting its contents. This can lead to corrupted updates. - Assuming
ipconfig /flushdnsalways works: Sometimes, the DNS cache resets itself or re-fills quickly. If you clear it but websites still load slowly, check for malware or ISP-level DNS issues. - Using Disk Cleanup too frequently: While safe, running Disk Cleanup weekly can disrupt software that relies on temporary files. Schedule it monthly or only when you need to free up space.
- Not verifying the cache is cleared:
After running
ipconfig /flushdns, always check withipconfig /displaydnsto confirm the cache is empty. If it’s not, the command may have failed due to permissions or corruption.
Tips for Best Results
- Combine commands for stubborn issues:
If DNS or WinSock problems persist, run these in sequence in one Command Prompt session:
ipconfig /flushdnsThen restart your PC.
netsh winsock reset
netsh int ip reset
netsh winsock reset catalog - Use a third-party tool for automation: Tools like CCleaner or Glary Utilities can automate cache clearing, but they may remove unnecessary files. Stick to manual methods unless you’re comfortable with their settings.
- Check for malware after clearing caches: If your PC was infected, malware may have corrupted system files. Run a scan with Windows Defender or Malwarebytes after clearing caches.
- Monitor disk space post-cleanup:
After clearing the system file cache, use
Win + R, typecleanmgr, and select C: again to ensure no critical errors appear (e.g., "Low Disk Space"). - Consider a full system sweep:
If performance issues persist, run
sfc /scannowanddism /online /cleanup-image /restorehealthin Command Prompt as Administrator. These commands repair corrupted system files. - Update drivers after clearing caches: Outdated or corrupt network drivers can cause cache-related issues. Update them via Device Manager (search for "Device Manager" in Start) or use the manufacturer’s website.
Troubleshooting
If the DNS Cache Won’t Clear
If ipconfig /flushdns shows errors or the cache persists, try these fixes:
- Restart your router: Power cycle your modem/router by unplugging it for 30 seconds, then plugging it back in. Wait 2 minutes for it to reboot.
- Change your DNS server:
Open Settings > Network & Internet > Wi-Fi (or Ethernet) > Hardware properties. Click Edit, then enter these Google DNS servers:
8.8.8.8(Preferred) and8.8.4.4(Alternate). Test connectivity withping google.com. - Use Command Prompt to force a DNS reset:
Run these commands in Command Prompt (Admin):
netsh int ip resetThen restart your PC.
ipconfig /release
ipconfig /renew - Check for ISP or regional DNS issues: If websites still fail to load, your ISP may be blocking DNS queries. Try using a VPN or contact your ISP’s support.
If WinSock Reset Fails
- Run
netsh winsock resetagain, but this time appendcatalog:netsh winsock reset catalogThis forces a deeper reset. - If you see errors like "Invalid parameter," your system may have a corrupted registry key. Use System Restore to revert to a point before the issue started.
- As a last resort, repair-install Windows while keeping your files. This replaces system files without deleting personal data.
If Disk Cleanup Finds No Temporary Files
- Your system may have already cleared recent temp files. Wait a few days for more to accumulate, then run Disk Cleanup again.
- Check for hidden system files:
- Open File Explorer, go to
View, and select Hidden items. - Navigate to
C:\Windows\Tempand delete all files here manually.
- Open File Explorer, go to
- Use the Storage Settings app to identify large files:
- Open Settings > System > Storage.
- Select Temporary files and remove all downloadable content (e.g., Thumbnails, Recycle Bin).
If Windows Update Fails After Clearing the Cache
- Reset the Windows Update components manually:
- Open Command Prompt (Admin) and run these in order:
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver - Rename the SoftwareDistribution folder (as in Part 4).
- Rename the Catroot2 folder:
ren C:\Windows\System32\catroot2 catroot2.old - Restart the services:
net start wuauserv
net start cryptSvc
net start bits
net start msiserver
- Open Command Prompt (Admin) and run these in order:
- Download and install the latest Windows update manually from the Microsoft Update Catalog.
- If updates still fail, use the Media Creation Tool to create a USB installer, then run Repair your PC from the boot menu.
If Your PC Slows Down After Clearing Caches
This is normal for the first few minutes as Windows rebuilds caches. If it persists:
- Check for background apps using Task Manager (Ctrl + Shift + Esc). End tasks like Chrome or Discord if they’re using excessive RAM.
- Run
sfc /scannowto repair corrupted system files. - Upgrade your RAM if you have less than 16GB. Low RAM forces Windows to rely more on the page file (swap), slowing performance.
Frequently Asked Questions
How often should I flush the Windows cache?
There’s no strict schedule, but aim to clear the DNS cache (ipconfig /flushdns) monthly or whenever you encounter network errors. Clear the system file cache (via Disk Cleanup) monthly or when your disk space drops below 15%. The Windows Update cache only needs clearing if updates fail repeatedly.
Will clearing the cache delete my files or apps?
No, clearing caches (DNS, system files, or Windows Update) only removes temporary data. Your documents, photos, installed apps, and settings remain intact. However, manually deleting the SoftwareDistribution folder or renaming it may temporarily disrupt updates until Windows recreates it.
Does flushing the cache improve gaming performance?
Only indirectly. If your PC is slow due to network issues (e.g., lag in online multiplayer) or low disk space, clearing caches may help. For gaming performance, focus on closing background apps, updating drivers, and ensuring your PC meets the game’s minimum requirements. Caches are unlikely to be the main bottleneck.
Can I automate cache clearing with a script?
Yes. Create a batch file (flushcache.bat) with these lines:
@echo off netsh winsock reset netsh int ip reset ipconfig /flushdns del /q /f "C:\Windows\SoftwareDistribution\Download\*.*" 2>nul net stop wuauserv net start wuauserv shutdown /r /t 0Save the file, right-click it, and select Run as administrator. This script resets WinSock, clears DNS, deletes update files, and restarts your PC. Test it in a safe environment first.
Why does my PC still feel slow after clearing caches?
Caches are rarely the sole cause of slow performance. Other likely culprits include:
- Insufficient RAM (upgrade to 16GB+).
- Fragmented or full hard drive (use
defragor switch to an SSD). - Malware or unnecessary startup programs (use Task Manager to check).
- Outdated drivers (update via Device Manager).
- Hardware overheating (clean fans or apply thermal paste).
msconfig to disable startup apps temporarily and monitor performance.
Is there a way to clear caches without restarting?
Most cache-clearing methods (e.g., ipconfig /flushdns or Disk Cleanup) won’t take effect until you restart your PC. The exceptions are:
- Manually deleting files in
C:\Windows\Temp(visible in File Explorer with hidden items enabled). - Using third-party tools like CCleaner (though these may remove non-temporary files).