Over time, Windows drives accumulate gigabytes of cached data. This includes old system updates (stored in the Component Store), temporary application files, browser indexes, and local DNS mapping tables.
If storage is running low, this background data can slow down index searches and drive access. This guide explains how to prune these caches safely without breaking your operating system.
1. Pruning the WinSxS Folder (Component Store Cleanup)
The C:\Windows\WinSxS (Windows Side-by-Side) folder stores backup system files to support Windows updates, rolls back patches, and repairs corrupted components. It is one of the largest folders on your system drive.
[!WARNING] Never delete files inside the WinSxS folder manually. Doing so will permanently corrupt the Windows installation. Always use DISM to clean it safely.
Step 1: Analyze the Component Store
Open Command Prompt as Administrator and run:
dism /online /cleanup-image /analyzecomponentstore
The tool will return detailed metrics, indicating if a cleanup is recommended:
Component Store Cleanup Recommended : Yes
Actual Size of Component Store : 14.82 GB
Shared with Windows : 6.10 GB
Backups and Disabled Features : 5.20 GB
Cache and Temporary Data : 3.52 GB
Step 2: Run the cleanup command
To compress unused backups and delete obsolete packages:
dism /online /cleanup-image /startcomponentcleanup
Step 3: Remove old update rollbacks
If you are confident that recent Windows updates are stable, you can purge old versions entirely (note: this prevents you from uninstalling the current update):
dism /online /cleanup-image /startcomponentcleanup /resetbase
2. Purging Local Temporary Files and Prefetch
Windows maintains dedicated folders where apps write short-term cache logs.
Cleaning Temp directories:
- Open PowerShell as Administrator and execute:
# Wipe the user-level temp folder Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue # Wipe the system-level temp folder Remove-Item -Path "$env:SystemRoot\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Clearing the Prefetch Cache
The Prefetch folder (C:\Windows\Prefetch) stores application launch metrics to speed up startup times. If applications are renamed or uninstalled, orphaned prefetch files accumulate.
- Run
shell:prefetchin the Run window (Win + R). - Press
Ctrl + Ato select all files, and pressShift + Deleteto purge them.
3. Emptying the Delivery Optimization Cache
Windows Update uses Delivery Optimization to download updates from other local PCs or peer-to-peer servers. This cache can grow to tens of gigabytes.
To purge these files:
- Open Settings > System > Storage.
- Click Temporary files.
- Check the box next to Delivery Optimization Files.
- Click Remove files.
To clear this folder via command-line run:
net stop dosvc
del /f /s /q %windir%\SoftwareDistribution\DeliveryOptimization\*
net start dosvc
4. Flushing Network and Browser DNS Caches
If you encounter connection drops or websites fail to load after a network swap, flush the local DNS resolver cache to clear outdated IP mappings:
ipconfig /flushdns
If you are debugging browser redirect issues:
- Chrome DNS Flush: Navigate to
chrome://net-internals/#dnsand click Clear host cache. - Edge DNS Flush: Navigate to
edge://net-internals/#dnsand click Clear host cache.