# Windows Temp Folder: What Is Safe to Delete

Windows has more than one temp folder. Your own is `%TEMP%`, normally `C:\Users\<name>\AppData\Local\Temp`; the system-wide one is `C:\Windows\Temp`, and on Windows 11 processes running as SYSTEM use `C:\Windows\SystemTemp`. Files older than about a week are safe to delete, files that are in use will refuse, and that refusal is normal: skip them rather than forcing it. The simplest safe route is Settings › System › Storage › Temporary files, or Storage Sense if you want it automatic.

## Where the temp folders are

Programs do not pick a temp folder at random. [Microsoft's GetTempPath2 reference](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w) gives the order for ordinary programs: the `TMP` environment variable, then `TEMP`, then `USERPROFILE`, then the Windows folder. For processes running as SYSTEM it returns `C:\Windows\SystemTemp`, which other processes cannot access.

| Folder | Who writes there | Who can clean it |
| --- | --- | --- |
| `%TEMP%` (`AppData\Local\Temp`) | Programs running in your account, including many installers | You, without administrator rights |
| `C:\Windows\Temp` | System-wide temporary work | An administrator |
| `C:\Windows\SystemTemp` | Processes running as SYSTEM | An administrator, with Windows' cleanup tools |

To open your own one, press `Win + R`, type `%TEMP%` and press Enter. Every Windows account has its own `%TEMP%`, so cleaning yours does not touch another user's.

<figure class="blog-diagram">
  <picture>
    <source media="(max-width: 900px)" srcset="/img/blog/windows-windows-temp-folder-cleanup-en-mobile.webp" type="image/webp" width="768" height="1180">
    <img src="/img/blog/windows-windows-temp-folder-cleanup-en.webp" width="1360" height="454" loading="lazy" alt="Two kinds of temp folders with different owners">
  </picture>
  <figcaption>Your account's programs write to %TEMP%, while the folders under C:\Windows belong to the whole PC and need administrator rights.</figcaption>
</figure>

## Why temp files pile up, and why some are locked

[Microsoft's cleanmgr reference](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr) describes the folder plainly: programs sometimes store temporary information in a Temp folder and usually delete it before they quit, and temporary files not modified within the last week can be deleted safely. What stays behind usually comes from programs that crashed, were closed during an install, or never clean up after themselves: unpacked installers, update downloads, log files, and caches some apps keep there on purpose.

A file a program still has open cannot be deleted, and Windows tells you the file is in use. That is the system protecting work in progress, such as an installer that unpacked itself and is waiting for you to click Next, or a video editor writing its scratch files. Skip those files. They are usually released once the program closes, and a restart closes everything, so the next cleanup gets them.

The one-week rule matters most in `C:\Windows\Temp`, where installers and Windows components can keep working files while a job runs. A file from today may be in the middle of an update. That is why Windows' tools and Mole both leave anything younger than a week.

## Clean it with Windows' own tools

On Windows 11, open Settings › System › Storage and select Temporary files. Windows lists categories with their sizes; tick only the ones you recognize and leave Downloads unticked unless you have checked that folder yourself. [Microsoft's free-up-space guide](https://support.microsoft.com/en-us/windows/experience/storage-filemanagement/free-up-drive-space-in-windows) also lists Temporary files under Cleanup recommendations.

To keep it automatic, turn on Storage Sense on the same Storage page. [Microsoft's Storage Sense guide](https://support.microsoft.com/en-us/windows/experience/storage-filemanagement/manage-drive-space-with-storage-sense) says that with default settings it runs when the device is low on disk space, and it leaves Downloads and cloud files alone unless you set rules for them. Disk Cleanup still works too; [Disk Cleanup vs Storage Sense](/windows/blog/disk-cleanup-vs-storage-sense-windows) compares them category by category.

## Check the size first, then clean by hand if you prefer

These PowerShell commands only read. The first shows the total size of `%TEMP%` in megabytes, the second how much of it is older than seven days:

```powershell
(Get-ChildItem $env:TEMP -Force -Recurse -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum / 1MB
$cutoff = (Get-Date).AddDays(-7)
(Get-ChildItem $env:TEMP -Force -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -lt $cutoff -and $_.CreationTime -lt $cutoff } | Measure-Object Length -Sum).Sum / 1MB
```

The age check reads both dates on purpose. A file copied or unpacked into Temp today can keep an old modified date from inside the archive; only its creation date says it arrived today. Checking both keeps a freshly unpacked installer out of the list.

If you want to delete by hand, preview first. With `-WhatIf`, PowerShell only prints what it would remove:

```powershell
$cutoff = (Get-Date).AddDays(-7)
Get-ChildItem $env:TEMP -Force -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -lt $cutoff -and $_.CreationTime -lt $cutoff } | Remove-Item -Force -WhatIf
```

Read the list, close the apps that own anything you recognize as in use, then run the same line without `-WhatIf`. `Remove-Item` deletes directly; nothing goes to the Recycle Bin. Errors for locked files are expected and change nothing.

## What not to do

- Do not delete the Temp folder itself or its `Low` subfolder. Programs expect the folders to exist; empty them, do not remove them.
- Do not take ownership of `C:\Windows\Temp` or `C:\Windows\SystemTemp` to force out files that refuse. Locked files there usually belong to a running installer, update or service.
- Do not clean during an installation, a Windows Update or a large export. Wait until it finishes or restart first.
- Do not point `TEMP` and `TMP` at another drive just to save space. Many programs and installers rely on them; Microsoft's [Dev Drive documentation](https://learn.microsoft.com/en-us/windows/dev-drive/) warns of side effects when moving them, even in the one setup where it suggests it.

## How Mole for Windows handles temp files

Mole's Clean lists two rows. **Temporary files** is your `%TEMP%` folder: it removes items older than seven days, judged by the newer of the modified and created dates as above, and keeps `%TEMP%\Low` because that folder carries a low integrity label that sandboxed programs need in order to write there. Files that are in use are skipped and picked up on a later run, and a folder emptied just now waits until its own dates are past the cutoff.

**Windows temporary files** covers `C:\Windows\Temp` and `C:\Windows\SystemTemp`, also older than seven days. These rows need administrator approval: Select all leaves them unticked, the permission prompt appears only when you clean, and declining keeps them. Folders inside are kept so a running installer's working folder is never removed. Ordinary rows follow the removal method in Settings; administrator rows are deleted directly. For the rest of what Clean lists, see the [cache cleanup guide](/windows/blog/windows-cache-cleanup).

## Check the result

Note free space on C: under This PC, clean, then check again. Temp folders fill up again as you use the PC, so a few hundred megabytes coming back next week is normal. If they grow by gigabytes every day, find the program writing there: sort `%TEMP%` by date modified, look at the newest folder names, and fix the program rather than cleaning more often. If space is still short, the cause is elsewhere; [Sorting out a full C: drive](/windows/blog/windows-c-drive-full) is the next step.

## FAQ

### Is it safe to delete temp files in Windows 11?

Yes, for files older than about a week. Microsoft says temporary files not modified in the last week can be deleted safely. Skip files that are in use; they belong to running programs.

### Where is the temp folder in Windows?

Your own is `%TEMP%`, normally `C:\Users\<name>\AppData\Local\Temp`. The system-wide folder is `C:\Windows\Temp`, and SYSTEM processes on Windows 11 use `C:\Windows\SystemTemp`.

### Why can't I delete some files in the Temp folder?

A program still has them open, often an installer, an update or an app's scratch files. Close the program or restart, then clean again. Do not take ownership to force it.

### Does Storage Sense delete temp files automatically?

Yes, once you turn it on. With default settings it cleans temporary files when the system drive is low on space, and it does not touch Downloads unless you set a rule for it.


Canonical: https://mole.fit/windows/blog/windows-temp-folder-cleanup
