How-to

How to free up disk space from developer caches on Windows (npm, pip, Gradle, Cargo)

Where npm, pip, Gradle and Cargo keep their caches on Windows, which are safe to clear, the official commands, and what a cleaner like Sweep does, from vendor docs.

Published ✓ Sources checked By Pickverge Editorial

Disclosure. Some links on this page are affiliate links. If you sign up through one, we may earn a commission at no extra cost to you. Commissions never decide our rankings.
Sources. Built from each vendor's official pricing, documentation and terms. Every claim links to its source, with the date we checked it. How we research

Short answer. Developer tools keep caches that you can usually delete without breaking anything, because each tool rebuilds or re-downloads what it needs. The official commands are npm cache clean --force and py -m pip cache purge. Gradle cleans its own caches automatically, and Cargo’s docs say any part of its cache can be removed. If you would rather review sizes in one list than run four tools’ commands, a paid utility such as Sweep does that, with the trade-offs listed below.

Package managers and build tools save downloads and build output so the next install or build is faster. On a busy machine these caches can take up a lot of space. The steps below come from each tool’s official documentation, checked on November 11, 2026. The cache will refill the next time you build, so you are trading disk space for a slower first build afterwards.

Where each cache lives and what the docs say

Tool Default location on Windows Official guidance on clearing
npm %LocalAppData%\npm-cache npm cache clean --force. Docs call the cache “self-healing” and say clearing is usually unnecessary except to reclaim space.
pip Run py -m pip cache dir to see it (the docs don’t state a default) py -m pip cache purge removes everything; py -m pip cache remove <pattern> removes specific packages.
Gradle C:\Users\<USERNAME>\.gradle (overridden by GRADLE_USER_HOME) Gradle “creates, uses, and cleans” its caches automatically. The docs give no statement on deleting them by hand.
Cargo $HOME/.cargo/ (overridden by CARGO_HOME) The Cargo book says you can remove any part of the cache and Cargo will restore what a crate needs.

Step by step

1. Check how big each cache is

Look at the folders above in File Explorer, or use the tool’s own command where one exists. For pip, py -m pip cache info shows information about the cache, and py -m pip cache dir shows where it is.

2. npm: clear or verify

Run npm cache clean --force. npm’s docs say the --force flag is required for clean. If you only want to check the cache, npm cache verify works offline, checks the cache index and data, and removes unneeded data. The docs note that npm re-fetches corrupted data automatically, so clearing is mainly for reclaiming space.

3. pip: purge or remove selectively

py -m pip cache purge removes all items from the cache. To remove only some packages, py -m pip cache remove <pattern> accepts a glob or a package name. py -m pip cache list shows what is stored.

4. Gradle: let it clean itself, or change the schedule

Gradle’s docs say it automatically cleans caches in both the Gradle User Home and the project directory, about once every 24 hours in the background when the daemon stops. Default retention for unused entries is 30 days for released wrapper distributions and downloaded resources, 7 days for snapshot distributions, created resources and build cache entries, and 14 days for daemon logs. You can change these through init scripts in init.d. The page does not say it is safe to delete the caches folder by hand, so check the current docs and close your IDEs and Gradle daemons first if you decide to.

5. Cargo: remove what you don’t need

The Cargo book lists registry/cache (downloaded .crate files), registry/src (unpacked sources) and git/checkouts as parts of the cache that Cargo can restore by re-extracting, checking out or re-downloading. It points to the third-party cargo-cache crate for clearing selected parts or showing the size of each. It does not mention a built-in garbage-collection command, and cargo clean removes only the target directory, so it is a different job.

Doing it with a cleaner instead: Sweep

Per its own page, Sweep is a Windows desktop utility for developers that scans for caches left by npm, pnpm, Yarn, pip, uv, Cargo, Gradle, Hugging Face, editors and Windows temporary files, and lets you pick what to remove.

What the vendor states:

  • Price: “$19 once,” no subscription and no account, with a free 30-day trial that needs no account or card. Payment is through Gumroad.
  • Safety: it shows items with sizes before removal, skips files in use, and labels each cache as rebuilding automatically, re-downloading when needed, or requiring a large re-download (the last starts unticked). It works inside your user folder and needs no administrator rights.
  • Important trade-off: “Removed files don’t go to the Recycle Bin,” so there is no undo from the bin. Sweep warns before removing.
  • Privacy claim: the page says it runs entirely offline, makes no network calls and checks the licence key on the PC.
  • Requirements: Windows 11, 64-bit. Docker’s disk and Ollama models are shown but not deleted.

We have not run Sweep and report only what the vendor publishes. Its refund terms were not visible on the page we checked.

Which approach to pick

  • You use one or two tools and are comfortable with a terminal: the official commands above are free and documented.
  • You use many tools and want one list with sizes and recovery notes: a cleaner such as Sweep is built for that, for a one-time fee after the trial.
  • You mostly use Gradle: the docs say it already cleans itself, so check whether the retention defaults fit your disk first.

What we couldn’t verify

  • How much space you will actually recover. It depends on your projects.
  • Sweep’s refund policy, and how it behaves on your machine. We report only vendor statements.
  • Whether deleting Gradle’s caches folder by hand is safe. The docs don’t say.
  • Cache locations if you changed them. npm config get cache, py -m pip cache dir, GRADLE_USER_HOME and CARGO_HOME show your current paths.

Sweep link is an affiliate link. Check each tool’s current documentation before deleting anything.

FAQ

Is it safe to delete the npm cache? npm’s docs describe the cache as self-healing, and npm cache clean --force clears it. The main effect is that packages are downloaded again when needed.

How do I clear the pip cache on Windows? Run py -m pip cache purge to remove all items, or py -m pip cache remove <pattern> for specific packages.

Does Sweep put deleted files in the Recycle Bin? No. Sweep’s page says removed files don’t go to the Recycle Bin, and that it warns you before removal.

Sources

  1. npm docs: npm cachechecked 2026-11-11
  2. pip docs: pip cachechecked 2026-11-11
  3. Gradle docs: Directory layoutchecked 2026-11-11
  4. Cargo book: Cargo homechecked 2026-11-11
  5. Sweep: Product pagechecked 2026-11-11