What temporary files are and why they pile up
Temporary files are scraps of data that programs create while they run — cached web pages, installer leftovers, crash reports, partially downloaded updates. Your operating system stores these in a dedicated temp folder so programs can work quickly without cluttering your main files. The problem is that nothing automatically empties this folder, so over weeks or months it can grow to several gigabytes.
Windows keeps temp files in a folder called AppData\Local\Temp. Mac stores them in /var/tmp and /tmp. Linux users typically find them in /tmp. Most of the time you will never see these folders because the operating system hides them. But they are always there, and they are always taking up space on your drive.
Clearing them out does not break anything. Programs will recreate the temp files they need the next time they run. You are simply deleting old scraps that nothing is using anymore.
Key Takeaways
- Temporary files accumulate in hidden system folders and can consume several gigabytes over time without affecting how programs work.
- Windows users can use the built-in Disk Cleanup tool to remove temp files without manually navigating hidden folders.
- Mac users can safely delete files in the /var/tmp folder using Terminal, or use a third-party cleaning tool if they prefer a graphical interface.
- Clearing temp files regularly — once a month or when storage is running low — keeps your drive responsive without risk of data loss.
- If a program crashes immediately after clearing temps, restart the program; it will recreate the files it needs.
Clearing temp files on Windows using Disk Cleanup
The easiest method on Windows is the built-in Disk Cleanup tool, which finds and removes temp files without you having to navigate hidden folders. Open the Start menu, type "Disk Cleanup" and press Enter. A window will open asking you to select a drive — choose the drive where your operating system is installed (usually C:).
Disk Cleanup will scan for temporary files and show you a list of categories you can delete. Look for "Temporary files" in the list and check the box next to it. You will also see other safe options like "Recycle Bin" and "Temporary internet files" — you can check those too if you want to free up more space. Click "Delete Files" and confirm. The process usually takes a few seconds to a minute depending on how many files are there.
If Disk Cleanup does not show much to delete, your temp folder may already be fairly clean. That is normal. Run it again in a few months and you will likely see more accumulation.
Clearing temp files on Windows manually
If you want to see exactly what is being deleted, you can navigate to the temp folder directly. Press the Windows key and R together to open the Run dialog, type "%temp%" and press Enter. A folder window will open showing the contents of your temp folder.
Select all files and folders in this window using Ctrl+A, then press Delete. Windows will ask for confirmation — click "Yes". Some files may be locked by running programs and will not delete; that is fine. Windows will skip those and delete everything else. Close the folder when done.
Do this only when you have time to restart your computer afterward, because some programs may behave oddly if they are looking for temp files that no longer exist. A restart clears this up immediately.
Clearing temp files on Mac
Mac users need to use Terminal to access the temp folders, since they are hidden by default. Open Terminal (search for it in Spotlight by pressing Command+Space, typing "Terminal", and pressing Enter). Type this command and press Enter:
rm -rf /var/tmp/*
This removes all files in the /var/tmp folder. Terminal will not show a confirmation message — if there is no error, the deletion succeeded. You can also clear the /tmp folder the same way by typing:
rm -rf /tmp/*
If you are not comfortable using Terminal, you can download a free cleaning tool like CleanMyMac X or Onyx, which provide a graphical interface for the same task. These tools do the same thing but show you a button to click instead of requiring command-line typing.
Clearing temp files on Linux
Linux temp files live in /tmp, which you can access through your file manager. Open your file manager, press Ctrl+L to show the location bar, type "/tmp" and press Enter. You will see the contents of the temp folder.
Select all files using Ctrl+A and press Delete. Some files may be in use by running programs and will refuse to delete — that is expected and safe to ignore. Everything else will be removed. Close the file manager when done.
Alternatively, open a terminal and type "sudo rm -rf /tmp/*" to delete from the command line. You will be asked for your password. Type it and press Enter.
How often to clear temp files and what to expect
There is no harm in clearing temp files weekly, but most people only need to do it once a month or when they notice their drive is running low on space. If your drive is nearly full, clearing temps can free up enough room to make your computer noticeably faster.
After clearing, your programs will work exactly as they did before. The first time you open a web browser, it will rebuild its cache. The first time you open a photo editor, it will recreate its working files. You will not see any difference in how things work — the only change is that your drive has more free space.
If a program crashes or behaves strangely immediately after clearing temps, simply restart the program. It will recreate whatever files it needs. A full restart of your computer is the safest option if you are concerned.
When temp files are not the problem
If you clear temp files and your drive is still nearly full, the space is being used by something else. Check your Downloads folder, Documents folder, and Desktop — these often contain old files people forget about. You can also right-click your main drive and select "Properties" (Windows) or "Get Info" (Mac) to see a breakdown of what is using the most space.
Large video files, photo libraries, and old backups are the usual culprits. Temp files are rarely more than a few gigabytes even after months of accumulation. If you are missing tens of gigabytes, look in your user folders first before assuming it is system files.
Frequently Asked Questions
Will clearing temp files break my programs?
No. Programs will recreate any temp files they need the next time they run. You are only deleting old scraps that nothing is using. If a program crashes after clearing temps, restart it — that almost always fixes the issue.
Is it safe to delete everything in the temp folder?
Yes, with one caveat: some files may be locked by programs that are currently running, and Windows or Mac will simply skip those. You cannot accidentally delete a file that a program needs right now. The only files that delete are ones nothing is using.
How much space will I free up?
It varies widely depending on how long it has been since you last cleared temps and what programs you use. Anywhere from 100 megabytes to several gigabytes is normal. Web browsers and video editors tend to create the largest temp files.
Do I need to restart my computer after clearing temps?
Not required, but it is the safest option if you are concerned about program behavior. Most of the time you can clear temps and keep working without any issues. A restart ensures any programs looking for deleted files will recreate them fresh.
What if I see a "file in use" error when trying to delete?
That means a running program is using that file. Close the program and try again, or simply skip that file — it is safe to leave it there. The important thing is deleting the old, unused files, which will delete successfully.