Getty Images/iStockphoto

Tip

How to use Disk Cleanup in Windows 11

Proper disk maintenance ensures peak performance for Windows PCs. Use built-in tools like Disk Cleanup and Storage Sense to optimize space and stability.

Maintaining good disk health is one of the most important tasks to keep Windows desktop PCs running at peak performance. Both Windows 11's built-in Disk Cleanup tool and similar third-party utilities can help.

Windows requires a disk to store the OS, applications and user data. It also uses disk space for temporary files, caching and virtual memory. Physical drives are usually split into partitions labeled by a letter, with the C: drive typically hosting the OS. External drives and USB flash storage can expand capacity.

Proper disk maintenance keeps systems fast, stable and easy to support. When available disk space runs out, Windows logs system errors and notifies the user. Low free disk space degrades performance, possibly causing apps and Windows itself to crash or fail.

While Microsoft now treats Disk Cleanup as a legacy tool and instead directs users toward the native Storage settings, it still exists in Windows 11 and can be helpful in some instances. Regular upkeep and running Disk Cleanup can improve boot time, application loading, file access and operations, and more.

How to use Windows 11 Disk Cleanup

Disk Cleanup is built into Windows 11. It offers most of the same capabilities as similar third-party products, but without any additional cost or installation. To use Disk Cleanup, take the following steps:

  1. From the Windows search bar, enter Disk Cleanup. Under the utility that appears, select Run as administrator. To view, delete or otherwise access system files, administrator access is required.
  2. In the window that appears on the screen, check the boxes of the files you want to remove. Note that the corresponding disk space is shown to the right of each set of files. This will help determine which files will return the most disk space. Selecting the file type will also display a description of the files.
  3. Select Clean up system files to delete unneeded system log files and others.
  4. Click on the More Options tab (Figure 1). If this tab does not appear, Disk Cleanup was not started with administrator privileges. In that case, close the dialog box and restart the process using administrator privileges.
The More Options tab in the Disk Cleanup window, showing options to clean up Programs and Features and System Restore and Shadow Copies.
Figure 1. Click on the More Options tab to see options to clean up installed applications and system restore points.
  1. To delete installed applications, click the Clean up… button under Programs and Features. To delete all system restore points except the most recent, click the Clean up… button under System Restore and Shadow Copies. This could result in significant disk space recovery.
  2. Once all the desired files are selected, click OK to start the removal.

Many of these files will only return 100 MB of disk space. This is a minuscule amount on a 500 GB disk. System Restore and Shadow Copies, crash dump files, and the Windows.old folder are examples of items that can recover a significant amount of disk space.

Before removing items such as temporary internet files, consider how much disk space will be recovered and if the removal will negatively affect UX. Deleting temporary internet files affects the user's internet browser experience, so deleting a few hundred megabytes probably isn't worth it.

Files to target for disk maintenance

Administrators should be familiar with the various file types that consume disk space and how Windows handles them. Consider the most common categories and their cleanup methods:

  • Unused applications. Applications might remain on a device despite never being used, leaving folders and files to take up valuable disk space. Admins can remove unused apps using the More Options tab in Disk Cleanup, the Windows Add or Remove Programs utility, or the application's uninstall utility. Be sure to back up user data.
  • Old documents or media. This might include office files, databases, videos, ISO downloads, training materials, Recycle Bin contents, thumbnail caches and downloaded program files. Typically, these items require manual removal.
  • Windows Update temporary files. The system creates these files whenever an OS update takes place, and you can use Disk Cleanup to remove them.
  • Browser caches and temporary files. Most internet browsers save temporary files on the local disk so webpages can load more quickly. Each browser maintains its own cache location for these pages. Disk Cleanup removes these files for Internet Explorer only. Caches and temporary files for Microsoft Edge, Chrome, Firefox and other third‑party browsers must be cleared manually through their settings.
  • Windows crash dump and debug files. System crashes generate memory dump (.dmp) files. Disk Cleanup can remove them if they're associated with System Error Memory Dump Files or Windows Error Reporting logs. Disk Cleanup can't remove debug-related files, such as .dbg, that are stored in custom locations or generated in development environments like Visual Studio. It does, however, remove any debug-related files produced by system error minidumps.
  • Checkpoint files. These files include Hyper-V and restore point data. They are not removed by Disk Cleanup. Instead, use Hyper-V Manager or PowerShell to delete them.
  • Windows.old. The OS creates this folder when upgrading from one Windows version to the next (i.e., Windows 10 to Windows 11). It might also appear after a custom installation of Windows without formatting the drive, or when refreshing the PC. This enables rollback to the previous version in case of installation problems or to recover files. This folder typically takes up 10 GB to 30 GB of disk space and can be removed with Disk Cleanup.

Disk Cleanup doesn't remove files that aren't system‑generated or that are stored outside default directories, such as developer-created .dbg files. A PowerShell script can delete these files, and it can be customized to target other types as well.

To find all .dbg files larger than 1 MB, for example, use the following PowerShell code:

Get-ChildItem -Path C:\ -Filter *.dbg -Recurse -ErrorAction SilentlyContinue |

  Where-Object { $_.Length -gt 1MB } |

  Select-Object FullName, Length, LastWriteTime

This script can be scheduled and launched using Task Scheduler.

Additional disk utilities

Windows 11 provides a few additional tools to assist with disk space management. It can help to use the Storage page or Storage Sense in Windows 11 Settings, as well as the Windows Defragment and Optimize Drives utility.

Storage

The Storage page is a more advanced, easy-to-read utility than Disk Cleanup. It shows all classifications of files -- many more than Disk Cleanup -- including Pictures, Desktop, Mail and OneDrive.

To access the Storage page, open Settings from the Windows Start menu and go to System > Storage (Figure 2). It also shows the total disk space each category uses, along with descriptions of the files.

The Storage page in Windows 11, listing all the categories of storage taking up disk space.
Figure 2. Open the Storage page to see the different categories of files on the disk and how much space they consume.

For a more granular listing of files and the disk space of each, click on a category. If you click on Temporary files specifically, you can choose temporary files to remove. Click the checkboxes for the files to delete and select Remove files toward the top of the page.

Windows Defragment and Optimize Drives

When programs run, they must find data that is stored on the disk to perform operations. The closer those blocks of data are to each other, the faster the app can run, as opposed to searching all over the disk to find them. Some of the data can be moved to form contiguous storage in an operation called defragmenting. Some items, such as Windows system files and data, cannot be moved.

Solid-state drives (SSDs) don't require defragmentation because they have no moving parts and access data at the same speed regardless of location. Windows 11 does run the Optimize Drives utility on SSDs, however, and traditional hard drives do benefit from both defragmenting and optimizing.

Windows 11 provides the Windows Defragment and Optimize Drives utility. Type Defrag into the Windows search bar and select the utility that appears. Once the Optimize Drives window opens, the following information and actions are available:

  • Type of drive.
  • The last time Defrag ran.
  • Status of optimization.

In addition, click the Optimize button for immediate optimization of the selected partition, or the Change settings button to schedule Defrag to run (Figure 3).

The Optimize Drives page in Windows 11, showing the different drives on the PC and their status, along with options to optimize the drives and change settings.
Figure 3. The Optimize Drives window provides options to optimize drives and change settings for scheduled optimization.

Storage Sense

Storage Sense automatically frees up space by removing content based on user‑defined rules. It specifically addresses the Recycle Bin, the Downloads folder, temporary system files and locally cached cloud content. Navigate to Settings > System > Storage > Storage Sense to enable it and configure it to run on a schedule.

Third-party disk cleaning tools

There are some third-party products that can help with disk purging and overall cleaning. Popular options include BleachBit, CCleaner, Glary Utilities and Wise Disk Cleaner.

When using any third-party tools, download them from the vendor's official website to minimize the risk of malware. Additionally, perform a full backup of your system, Windows registry and data prior to running any disk utilities.

Managing disk space is critical to providing a positive UX in terms of workstation performance and minimal disruption. Using built-in tools such as Disk Cleanup on a regular basis can help provide a healthy environment for data to be used and programs to execute.

Gary Olsen has worked in the IT industry since 1983 and holds a Master of Science in computer-aided manufacturing from Brigham Young University. He was on Microsoft's Windows 2000 beta support team for Active Directory from 1998 to 2000 and has written two books on Active Directory and numerous technical articles for magazines and websites.

Dig Deeper on Windows OS and management