Guide for developers
Developer disk hygiene on Windows: Gradle, npm, pip, NuGet and pub caches
Package managers keep a copy of everything they download, so the next build is fast. Over a few years that adds up to many gigabytes. All of these caches refill on their own, so clearing them is safe. The cost is time: the next build downloads again.
By Randeep Singh, who makes Klenso and builds apps himself. Written 18 November 2026. Cache sizes differ enormously between machines, so I have not quoted any figures: check yours first.
Check the size first
Right-click a cache folder in File Explorer and choose Properties to see how much it holds. If it is small, leave it alone. If you have not opened the projects that filled it for months, clearing it is an easy win.
Each cache, and how to clear it
- npm. The default cache is usually in
%LocalAppData%\npm-cache. Runnpm config get cacheto see where yours is. Clear it withnpm cache clean --force. - pip (Python). Run
pip cache dirto see the location andpip cache infofor its size. Clear it withpip cache purge. - NuGet (.NET). Run
dotnet nuget locals all --listto see the folders. Clear them withdotnet nuget locals all --clear. - Dart and Flutter pub. The cache is usually under
%LocalAppData%\Pub\Cache. Clear it withdart pub cache clean. Flutter users can runflutter pub cache clean. - Gradle (Android and Java). The cache is in the
.gradlefolder in your user folder, undercaches. Stop any running builds first (gradle --stop, or close Android Studio), then delete the contents of.gradle\caches. The next build downloads what it needs again.
Run these in a normal terminal, not as administrator, so you only touch your own files. If a command is not recognised, that tool is not installed, and its cache will not be either.
Before you clear anything
- Close your editors and builds. A cache in use may not clear cleanly.
- Be online next time. The first build after clearing downloads everything again. On a slow or metered connection, or when you are travelling, leave the caches alone.
- Do not delete private package sources or local feeds. Only the download caches are safe to clear. A local folder you set up as a package source is not a cache.
What Klenso does
Klenso's free scan reports the size of the Gradle, npm, pip, Dart pub and Android build caches, and your Temp folder (files older than 7 days only), and removes nothing. If you clean, those caches are removed for good because they rebuild, they are labelled that way, and you must type CLEAN to confirm. Klenso does not look at NuGet, so use the command above for that one. The rules are on the what Klenso touches page.
Related: clearing old node_modules and build folders, which saves more than the caches on most machines.