How to Remove temporary files in Windows 11 for more storage

Over time, your Windows 11 PC can accumulate a significant amount of junk, often in the form of temporary files. These are files that the Windows operating system, applications, and web browsers create for short-term use. While initially serving a purpose (like speeding up processes or storing data during an operation), many of them become redundant and simply sit on your hard drive, taking up valuable storage space. This can lead to decreased performance, slower boot times, and even prevent you from installing new applications or downloading large files.

The concept of “temporary files” dates back to the early days of computing, as applications needed scratch space for operations. However, modern operating systems and applications are more complex, generating a wider variety of temporary data, including update logs, installer remnants, browser caches, and delivery optimization files. Fortunately, Windows 11 provides robust built-in tools to help you identify and safely remove these unnecessary files, helping you reclaim disk space and maintain your system’s health.

This guide will walk you through the most effective methods to clean up temporary files in Windows 11, ensuring your PC runs efficiently and you have ample storage.

Why Remove Temporary Files?

Regularly cleaning temporary files is a crucial aspect of PC maintenance. Here’s why it’s important:

  • Reclaim Disk Space: The most obvious benefit. Temporary files can grow to several gigabytes, especially on systems with heavy usage.
  • Improve Performance: While not a magic bullet for all slowdowns, a cluttered drive can contribute to slower boot times and application loading. Removing temporary files helps streamline disk access.
  • Resolve Errors: Sometimes, corrupted temporary files can lead to application crashes or system errors. Deleting them can resolve such issues.
  • Maintain System Hygiene: It keeps your system clean and organized, preventing unnecessary clutter.

Method 1: Using Storage Sense (Automated and Manual Cleanup)

Storage Sense is a smart, automated disk cleanup utility in Windows 11 that can automatically free up space by deleting temporary files, emptying the Recycle Bin, and managing cloud-backed content. It also allows for manual, on-demand cleanup.

  1. Enabling and Configuring Storage Sense (Automated Cleanup)
  1. Open Settings: Click the Start button and select Settings (the gear icon).
  2. Go to System > Storage: In the Settings window, click on System in the left-hand menu, then select Storage in the right-hand pane.
  3. Turn on Storage Sense: Under “Storage management,” toggle the Storage Sense switch to On.
  4. Configure Storage Sense (Optional): Click on Storage Sense to customize its behavior.
    • Run Storage Sense: Choose how often you want Storage Sense to run (e.g., daily, weekly, monthly, or during low free disk space).
    • Delete temporary files: Ensure “Keep Windows running smoothly by automatically cleaning up temporary system and app files” is checked.
    • Delete files in my recycle bin: Configure how long files stay in the Recycle Bin before being automatically deleted.
    • Delete files in my Downloads folder: Exercise caution here! Only enable this if you regularly move important files out of your Downloads folder. You can set a retention period.
    • Cloud content cleanup: Configure how old locally available OneDrive files are automatically made online-only.
  1. Running Storage Sense Manually (On-Demand Cleanup)

Even if Storage Sense is off, or you just want a quick cleanup, you can run it manually.

  1. Open Settings > System > Storage.
  2. Under “Storage management,” click on Temporary files.
  3. Windows will scan for temporary files. This might take a moment.
  4. Select files to remove: A list of different categories of temporary files will appear, along with the space they occupy. Common categories include:
    • Temporary Windows installation files: Old files from Windows upgrades. (Can be large)
    • Windows Update Cleanup: Files left over from Windows updates.
    • Delivery Optimization Files: Files used to share updates with other PCs on your network or the internet.
    • Temporary files: General temporary files created by applications.
    • Recycle Bin: Files you’ve deleted but not permanently removed.
    • Thumbnails: Cached images for file previews.
    • DirectX Shader Cache: Shader files used by games and 3D applications.
    • Previous Windows installation(s): Can be huge! This is left over if you upgraded Windows and want the option to roll back. If you’re sure you don’t need to revert, this is a major space saver.
  5. Review carefully! Before proceeding, deselect any categories you’re unsure about or want to keep (e.g., if you plan to roll back to a previous Windows version, don’t delete “Previous Windows installation(s)”).
  6. Click Remove files: Once you’ve made your selections, click the Remove files button.
  7. Confirm: Confirm the deletion if prompted.

Method 2: Using Disk Cleanup (Classic Method)

Disk Cleanup is a venerable utility that has been a part of Windows for many years. While Storage Sense offers a more modern interface, Disk Cleanup remains a reliable tool, especially for cleaning system files that Storage Sense might miss.

  1. Open Disk Cleanup:
    • Click the Start button.
    • Type disk cleanup in the search bar and select the Disk Cleanup application.
  2. Select Drive: If you have multiple drives, a small window will pop up asking you to select the drive you want to clean (usually C: for the system drive). Click OK.
  3. Scan for Files: Disk Cleanup will scan your drive for temporary and unnecessary files. This may take a few moments.
  4. Clean Up System Files (Crucial Step): After the initial scan, you’ll see a list of files to delete. To access more categories (like Windows Update Cleanup), click the Clean up system files button in the bottom-left corner of the Disk Cleanup window.
  5. Reselect Drive (if prompted): You might be asked to select the drive again. Click OK.
  6. Second Scan and Selection: Disk Cleanup will perform a deeper scan for system-level temporary files. Once complete, a new, more comprehensive list of file categories will appear.
    • Review the categories carefully. Check the boxes next to the types of files you want to delete. Common large categories include:
      • Windows Update Cleanup
      • Delivery Optimization Files
      • Temporary Windows installation files
      • Previous Windows installation(s)
      • Recycle Bin
      • Temporary files
      • Thumbnails
    • Be cautious with “Downloads” if it appears and you store important files there.
  7. Confirm Deletion: Click OK once you’ve made your selections.
  8. Confirm Again: You will be asked “Are you sure you want to permanently delete these files?” Click Delete Files.

The cleanup process will begin. It can take several minutes, or even longer if you’re deleting a large amount of data like previous Windows installations.

Method 3: Manually Deleting Temporary Files via Run Command

While the above methods are generally sufficient, some users prefer a more direct approach to the main temporary folders. This method requires a bit more care.

  1. Open Run Dialog: Press Windows key + R on your keyboard to open the Run dialog box.
  2. Navigate to Temporary Folder 1:
    • Type %temp% and press Enter. This will open your user’s temporary folder.
    • Press Ctrl + A to select all files and folders.
    • Press the Delete key.
    • If you encounter a “Folder In Use” dialog for some files, click Skip for those items, as they are currently in use by active programs.
  3. Navigate to Temporary Folder 2 (System Temp):
    • Open the Run dialog again (Windows key + R).
    • Type temp and press Enter. This might require administrator permission; click Continue if prompted. This opens the system’s temporary folder.
    • Select all files and folders (Ctrl + A) and press Delete.
    • Skip any files that are currently in use.
  4. Navigate to Prefetch Folder (Caution Recommended):
    • Open the Run dialog again (Windows key + R).
    • Type prefetch and press Enter. Click Continue if prompted. The Prefetch folder helps applications load faster by caching data.
    • You can delete its contents, but Windows will rebuild the cache over time. Deleting here is generally safe but might briefly slow application launches until the cache is rebuilt. Select all files and folders (Ctrl + A) and press Delete. Skip any in-use files.

Key Considerations and Best Practices

  • Restart After Cleanup: After performing any major temporary file cleanup, it’s a good practice to restart your computer. This helps clear any lingering cached data and fully applies the changes.
  • Regular Maintenance: Make a habit of checking for and removing temporary files regularly, especially if you have a smaller SSD. Using Storage Sense automated cleanup is highly recommended.
  • Recycle Bin: Don’t forget to periodically empty your Recycle Bin. Files moved to the Recycle Bin still occupy disk space until permanently deleted.
  • Downloads Folder: Pay attention to your Downloads folder. Many users forget about large installer files, ISOs, or downloaded media that can accumulate here. Manually clean this folder.
  • Browser Caches: While system tools handle some browser caches, individual browsers (Chrome, Firefox, Edge) also have their own settings to clear Browse data, including cache and cookies. This can free up significant space.
  • Hibernation File: The hibernation file (hiberfil.sys) can take up substantial space (equal to your RAM size). If you don’t use hibernation, you can disable it via Command Prompt (as Administrator) by typing powercfg.exe /hibernate off. This is a system file and not a temporary file in the traditional sense, but it can be a significant storage hog.
  • System Protection (Restore Points): While helpful for recovery, System Restore Points also consume disk space. Manage their allocation in System Properties > System Protection. You can adjust the “Max Usage” slider or delete older restore points if needed, but be mindful of your ability to revert.

FAQ Section

Q1: Are temporary files safe to delete?

Yes, the temporary files identified by Storage Sense and Disk Cleanup are generally safe to delete. These are files that the system or applications no longer need. Files currently in use by an active program will typically be skipped during the deletion process.

Q2: How often should I remove temporary files?

For most users, running a temporary file cleanup once a month is a good routine. If you frequently download large files, install/uninstall many programs, or your PC has limited storage space, you might consider doing it more often, perhaps bi-weekly. Enabling Storage Sense to run automatically is the most convenient way.

Q3: Will deleting temporary files improve my PC’s speed significantly?

While deleting temporary files can help improve overall system responsiveness by freeing up disk space and reducing disk clutter, it’s typically not a magic solution for major performance issues. Significant speed improvements are more often gained by upgrading hardware (like moving to an SSD), adding more RAM, or resolving CPU-intensive background processes.

Q4: What are “Delivery Optimization Files” and can I delete them?

Delivery Optimization Files are used by Windows Update to deliver updates more efficiently. They store parts of Windows updates that can then be shared with other PCs on your local network or even other internet users (if you have the setting enabled). Yes, they are safe to delete via Storage Sense or Disk Cleanup, as they are essentially a cache for updates.

Q5: Will deleting “Previous Windows installation(s)” prevent me from going back to an older Windows version?

Yes, if you delete “Previous Windows installation(s)” via Disk Cleanup or Storage Sense, you will lose the ability to easily revert to the previous major version of Windows (e.g., from Windows 11 back to Windows 10, or from a recent Windows 11 feature update back to the one before it) using the built-in “Go back” option in recovery settings. Only delete this if you are absolutely sure you won’t need to revert.