Drive Sweeper
Windows 10 & 11 Buy license · $29.95
Junk files

How to Delete Temporary Files in Windows 11 (and Which Ones to Keep)

Delete temporary files in Windows 11 the safe way: Settings, Disk Cleanup and the %temp% folder step by step, plus which categories are worth clearing.

Updated 5 minute read The Drive Sweeper team

The quickest safe way to delete temporary files in Windows 11 is Settings > System > Storage > Temporary files: tick the categories you want, leave Downloads unticked unless you have checked it, and click Remove files. You can also clear your personal temp folder by typing %temp% into the Run box and deleting its contents, or use the classic Disk Cleanup tool for system files. All three methods are safe as long as you know what each category contains, which is what this guide explains.

What counts as a temporary file?

Windows and your apps constantly create working files: installers unpack into temp folders, browsers cache images, Windows Update downloads packages, and crash reports are saved for diagnostics. Most of these are meant to be cleaned up automatically, but plenty are left behind. Over months, they can add up to several gigabytes.

The main locations are:

  • Your user temp folder: C:\Users\YourName\AppData\Local\Temp, which is what %temp% points to.
  • The Windows temp folder: C:\Windows\Temp, used by Windows and installers.
  • Update and delivery caches: managed by Windows Update and cleared through Settings or Disk Cleanup.
  • App caches: browsers and other apps keep their own caches inside AppData.

Method 1: Delete temporary files from Settings

  1. Press Windows + I and go to System > Storage.
  2. Click Temporary files. Windows takes a moment to calculate each category.
  3. Read the list and tick what you want to remove (see the table below).
  4. Click Remove files and confirm.

Files deleted here skip the Recycle Bin. If Downloads or Recycle Bin is ticked, everything in them is gone for good, so check both before you click Remove files.

Which temporary file categories are safe to delete?

CategoryWhat it isSafe to delete?
Temporary filesLeftover working files from appsYes
Windows Update CleanupOlder versions of updated system componentsYes; you may not be able to uninstall some older updates afterwards
Delivery Optimization FilesUpdate files kept to share with other PCsYes
ThumbnailsCached previews for File ExplorerYes; they rebuild when you browse folders
Windows error reports and feedback diagnosticsCrash and diagnostic reportsYes, unless you are troubleshooting
DirectX Shader CacheCompiled graphics shadersYes; games may load slightly slower once while it rebuilds
Microsoft Defender AntivirusNon-critical files used by DefenderYes
Temporary Internet FilesLegacy browser cacheYes
Previous Windows installation(s)Windows.old after an upgradeYes, but you lose the option to roll back
Recycle BinFiles you deleted earlierOnly if you have checked it
DownloadsYour Downloads folderOnly if you have checked it; these are your own files

Not every PC shows every category. Windows only lists the ones that currently have files in them.

Method 2: Clear the %temp% folder by hand

Settings does not always catch everything in your personal temp folder. To clear it directly:

  1. Close your open apps, especially anything with unsaved work.
  2. Press Windows + R, type %temp% and press Enter. File Explorer opens your temp folder.
  3. Press Ctrl + A to select everything.
  4. Press Delete, or Shift + Delete to skip the Recycle Bin.
  5. When Windows says a file is in use, tick Do this for all current items and click Skip. Those files belong to running programs.

To clear C:\Windows\Temp, repeat the same steps with that path. You will need to approve an administrator prompt. Do not delete the Temp folder itself, only what is inside it.

Method 3: Use Disk Cleanup for system files

Disk Cleanup is still included in Windows 11 and some people prefer its simple list.

  1. Click Start, type Disk Cleanup and open it (or run cleanmgr).
  2. Choose drive C and click OK.
  3. Click Clean up system files and choose C again. This adds Windows Update Cleanup and other system categories.
  4. Tick the categories you want and click OK, then Delete Files.

The Windows Update Cleanup step can take a long time. Let it finish. For the differences between Disk Cleanup and the newer Settings tools, see Disk Cleanup vs Storage Sense.

When temporary files will not delete

It is normal for a few files to refuse. Here is what usually causes it and what to do:

  • "The action can't be completed because the file is open": a running program is using it. Skip it, or restart the PC and try again before opening any apps.
  • "You need permission to perform this action": the file belongs to Windows or another account. In C:\Windows\Temp, approve the administrator prompt. If it still refuses, leave it.
  • The size in Settings does not go down: some categories are recalculated slowly. Close Settings, wait a minute and open it again, or compare free space in File Explorer under This PC before and after.
  • Windows Update Cleanup seems stuck: this step checks every system component and can take a long time on older PCs. Give it time rather than cancelling.

Never force-delete temp files with third-party unlocking tools or by taking ownership of system folders. A file that is locked is in use for a reason, and it will usually be cleared on a later run.

Keep temporary files under control automatically

Temporary files always come back, because Windows and apps create them as they work. Rather than clearing them by hand every month, turn on Storage Sense:

  1. Go to Settings > System > Storage > Storage Sense.
  2. Make sure Cleanup of temporary files is ticked.
  3. Turn on Automatic User content cleanup and choose a schedule.
  4. Leave the Downloads setting on Never unless you want Windows to remove old downloads automatically.

If you would rather have one schedule that covers more than temp files, Drive Sweeper can run a sweep every week or month and show a notice when your drive is getting full.

Temporary files are only part of the story

Clearing temp files typically recovers a few gigabytes. On a well-used PC, far more space usually sits in duplicate files, huge forgotten files and years of old downloads, none of which Windows' temporary file tools look at.

Drive Sweeper clears Windows temporary files, update leftovers, browser caches, crash dumps and log files in the same sweep that finds duplicates, huge files and old downloads. Temporary junk is marked safe to remove, everything else is shown for review, and anything removed can be restored for 30 days if you change your mind. Unlike the built-in tools, which delete permanently, that gives you a way back.

If you are unsure whether clearing temp files could cause problems, our guide is it safe to delete temp files? covers the edge cases. And for a complete plan beyond temp files, see how to free up disk space on Windows 11.

Frequently asked questions

Is it safe to delete everything in the %temp% folder?

Yes for anything Windows lets you delete. Files that are in use will be skipped with a message, so choose Skip and leave them for next time.

Why do temporary files come back after I delete them?

Windows and your apps create temporary files constantly while they run. That is normal; the goal is to clear the build-up every so often, not to keep the folder empty.

Should I tick Downloads in the Temporary files list?

Only if you have checked your Downloads folder first. Windows includes it in the list, but it holds your own files and they are removed without going to the Recycle Bin.

Get three guides like this every month, plus software update notices.Subscribe →