What temporary files are and why you might need to open them
Temporary files are fragments that programs create while they're running — partial downloads, unsaved document versions, cache data, installation files mid-process. Most of the time your computer deletes them automatically when the program closes or the task finishes. But sometimes they stick around, and you might want to look inside them: to recover an unsaved document, to see what a crashed program was trying to do, or simply to free up disk space by deleting old ones.
The files themselves are usually harmless. The risk comes from opening a temp file that belongs to a program still using it, which can corrupt the file or cause the program to crash. The other risk is opening a temp file from an untrusted source — malware sometimes hides in temp folders — but if the file came from your own computer's normal operations, it's safe to look at.
Key Takeaways
- Temporary files live in specific folders on your hard drive: %TEMP% on Windows and /var/tmp or /tmp on Mac and Linux.
- The fastest way to open a temp folder is to paste the path directly into your file manager's address bar rather than navigating folder by folder.
- Before opening a temp file, close the program that created it, because some programs lock their temp files while running.
- Temp files often have no file extension or an unfamiliar one, so you may need to try opening them with a text editor or the program that created them.
- Deleting temp files is usually safe once you've closed all running programs, and it can recover gigabytes of disk space.
Finding the temp folder on Windows
On Windows, temporary files live in a hidden folder. The quickest way to reach it is to open File Explorer, click the address bar at the top (where it shows your current folder path), and type %TEMP% exactly as written, then press Enter. Windows will take you directly to your temp folder.
If that doesn't work, you can navigate manually: open File Explorer, click "This PC" on the left, open your C: drive, then look for a folder called AppData. It's hidden by default, so you may need to click the View menu at the top and turn on "Hidden items" first. Once you see AppData, open it, then Local, then Temp. That folder contains your temporary files.
You can also type %LOCALAPPDATA%\Temp in the address bar if you want to be more specific about which temp location you're accessing — Windows actually has two: one for the current user and one for the system itself.
Finding the temp folder on Mac and Linux
On Mac, open Finder and press Command+Shift+G to bring up the "Go to Folder" dialog. Type /var/tmp and press Enter. This takes you to the temporary files folder. You can also try /tmp, which is another location where macOS stores temporary data.
On Linux, open your file manager and use the same keyboard shortcut or menu option to access the location bar. Type /tmp to reach the main temporary files folder, or /var/tmp for longer-term temporary storage. The /tmp folder is cleared more frequently by the system, while /var/tmp persists longer.
Opening a temp file when you don't know what it is
Temp files often have no file extension (no .txt, .pdf, or .docx at the end) or an extension you don't recognize. If you want to see what's inside, right-click the file and choose "Open with" to pick a program. Start with a text editor like Notepad (Windows) or TextEdit (Mac) — if the file is readable text, you'll see it. If it's binary data (images, video, or compressed files), the text editor will show gibberish, which means you need a different program.
If you know which program created the temp file — for example, a Word document that crashed — try opening it with that program instead. Many programs can read their own temporary files. You can also try dragging the temp file onto a program icon to see if that program recognizes it.
If the file is completely unreadable and you don't know what created it, it's safe to delete it. Temp files are meant to be temporary, and if a program needed it, the program would recreate it.
Recovering an unsaved document from temp files
If you closed a document without saving, your best chance of recovery is in the temp folder. Most programs — Word, Google Docs, Photoshop, and others — save backup copies there while you're working. Look for files with recent dates (today's date or yesterday) and file names that match what you were working on, or that contain partial text from your document.
Once you find a likely candidate, copy it to your Desktop or Documents folder first, then try opening it with the program you were using. If it opens, you can save it with a proper name and location. If it doesn't open directly, try renaming it to add the correct file extension — for example, if you think it's a Word document, add .docx to the end of the file name, then try opening it again.
Safely deleting temporary files
Before you delete temp files, close all open programs. Some programs lock their temp files while they're running, and deleting them can cause crashes or data loss. Once everything is closed, you can select temp files and press Delete, or right-click and choose Delete.
If you want to delete everything in the temp folder at once, select all (Ctrl+A on Windows, Command+A on Mac), then delete. Windows will ask you to confirm; some files may be in use and won't delete, which is fine — just skip those. You can also use the Disk Cleanup tool on Windows (search for "Disk Cleanup" in the Start menu) to delete temp files automatically, or use CleanMyMac on Mac for the same purpose.
Deleting temp files is safe and can recover significant disk space, especially if your computer is old or you haven't cleaned them in a while. The files are meant to be temporary, and your programs will recreate them as needed.
When temp files won't open or delete
If a temp file won't open, the most common reason is that a program is still using it. Close all programs and try again. If a file still won't delete, it's usually locked by a running process. Restart your computer and try deleting it immediately after startup, before programs have time to recreate locks on their temp files.
On Windows, you can also try using the Command Prompt to force delete a stubborn file. Open Command Prompt as Administrator (search for "cmd" in the Start menu, right-click, and choose "Run as administrator"), then type del C:\Users\YourUsername\AppData\Local\Temp\filename, replacing YourUsername with your actual username and filename with the name of the file you want to delete. Press Enter to delete it.
Frequently Asked Questions
Is it safe to delete all files in the temp folder?
Yes, as long as you close all programs first. Temp files are meant to be temporary, and your computer will recreate them as needed. The only exception is if a program is actively using a temp file — Windows will prevent you from deleting those, so you can safely skip them.
Can I recover a file I accidentally deleted from the temp folder?
Possibly, but it's unlikely. Temp files are meant to be deleted, and once they're gone, recovery is difficult. Your best option is to check your Recycle Bin (Windows) or Trash (Mac) immediately — if the file is still there, you can restore it. After that, you would need data recovery software, which works better on files you deleted from other locations.
Why does my temp folder keep filling up?
Programs sometimes fail to clean up their temp files when they close, especially if they crash. Malware can also create temp files and leave them behind. If your temp folder is growing unusually fast, run a malware scan with Windows Defender (Windows) or Malwarebytes, then delete the temp files. If the problem continues, a specific program may be misbehaving — check which files are being created most recently and note which program was running when they appeared.
What's the difference between %TEMP% and %LOCALAPPDATA%\Temp on Windows?
%TEMP% is a shortcut that takes you to your user's temp folder. %LOCALAPPDATA%\Temp is the full path to the same location. They point to the same place, so it doesn't matter which one you use. Windows also has a system temp folder separate from your user temp folder, but you rarely need to access it.
Can I open a temp file while the program that created it is still running?
You can try, but the program may have locked the file to prevent changes while it's using it. If the file is locked, you won't be able to edit it, and opening it might cause the program to crash. Close the program first, then open the temp file.