How to Delete Temporary Files in Windows 11 (Full Step-by-Step Guide)

Reading time icon 5 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

How to delete Temporary Files in Windows 11 [Complete Guide]

Knowing how to delete temporary files in Windows 11 is essential for keeping your PC running fast and clutter-free. This guide shows you every safe and effective way to remove temp files, from simple built-in tools to advanced cleanup options.

How can I delete temporary files in Windows 11?

How to delete temporary files in Windows 11

1. Use the Settings menu

  1. Hit the Windows key, then open the Settings menu.settings start menu
  2. Select the System section, then navigate to Storage.system storage settings app
  3. Click on the Temporary files section.temporary files selected in storage
  4. Checkmark all the files you want to delete, then click on the Remove files button.remove files button temporary storage

To delete temp files, you must have administrator access or else, you’ll get the folder access denied message.

2. Try Disk Cleanup

  1. 1. Press the Windows key on your keyboard.

  2. 2. Type Disk Cleanup in the search box that opens, and click on the result to open the app.

    disk cleanup windows 11 launch
  3. 3. Checkmark the files you want to delete, then click on OK.

    disk cleanup remove temporary files windows 11
  4. 4. After, click on the Clean up system files button.

    how to delete temporary files windows 11 system files
  5. 5. Select the files you want to delete, then click on OK.

    delete temporary files windows 11 click ok
  6. 6. To confirm the changes, click on the Delete Files button.

    remove temporary files in windows 11 confirm

Disk Cleanup is a free disk cleaner that’s built into Windows 11, but if you want something more advanced, you can also try using automatic repair and optimization software.

3. Delete files from Temp Folder

3.1 With File Explorer

  1. Use the following keyboard shortcut: Windows + R.
  2. In the Run dialog box, type %temp%, then click OK.%temp% run dialog
  3. Select the files you need to delete, then click on the Delete icon, marked as a trash.delete icon temporary files

3.2 With Command Prompt

  1. Press on the Windows key, type cmd, then choose to Run as administrator.cmd run as administrator
  2. Copy and paste the following command, then hit the Enter key: del /q/f/s %TEMP%\*
  3. Now all the temporary files that don’t require additional permissions will be deleted.deleting temporary files cmd

This is one of the fastest ways to perform a junk files cleanup, so don’t hesitate to try it.

4. Automatically clear Temporary Files with Storage Sense

  1. Navigate to the Storage page, from the Windows Settings menu.
  2. Look at the Storage Sense section, then make sure the toggle button is set on On.storage sense enable
  3. Now click on the Storage Sense section to customize various options.
  4. In the opened window, under Configure cleanup schedules, select the drop-down menus for each section, then select the desired options.storage sense configure

After enabling Storage Sense in Windows 11 and configuration, your temporary files will be automatically cleaned on your system as per the set schedule.

5. Delete Prefetch Folder Contents

  1. Press Windows + R to open the Run dialog.
  2. Type prefetch and hit Enter.
  3. If asked for permission, click Continue.
  4. Press Ctrl + A to select all files.
  5. Press Shift + Delete to permanently remove them.
  6. Skip any files in use.

6. Clear Browser Cache

For Microsoft Edge or Chrome:

  1. Open the browser.
  2. Press Ctrl + Shift + Delete.
  3. Check Cached images and files.
  4. Select All time as the time range.
  5. Click Clear now or Clear data.

For Firefox:

  1. Open Firefox and press Ctrl + Shift + Delete.
  2. Check Cache.
  3. Select Everything as the time range.
  4. Click OK to delete.

7. Manually Delete Files in C:\Windows\Temp

  1. Open File Explorer with Windows + E.
  2. Navigate to: C:\Windows\Temp.
  3. Press Ctrl + A to select all contents.
  4. Press Shift + Delete to remove them permanently.
  5. Skip any files in use or locked by the system.

8. Delete Windows Update Cache (SoftwareDistribution Folder)

  1. Press Windows + R, type services.msc, and hit Enter.
  2. Scroll to Windows Update, right-click it, and select Stop.
  3. Open File Explorer and go to: C:\Windows\SoftwareDistribution\Download.
  4. Delete all files in that folder.
  5. Return to services.msc, right-click Windows Update, and click Start.

9. Disable Hibernation to Remove hiberfil.sys

  1. Press Windows + X and select Terminal (Admin) or Command Prompt (Admin).
  2. Type this command and press Enter:
    powercfg -h off
  3. This disables hibernation and deletes the hidden hiberfil.sys file.

10. Use Safe Mode to Delete Locked Temp Files

  1. Press Windows + I to open Settings.
  2. Go to System > Recovery > Advanced startup.
  3. Click Restart now.
  4. On the blue screen, go to: Troubleshoot > Advanced options > Startup Settings > Restart.
  5. Press 4 or F4 to boot into Safe Mode.
  6. Once in Safe Mode, delete:
    • %temp% via Run
    • C:\Windows\Temp
    • prefetch
  7. Restart your PC normally.

11. Automate Temp File Deletion with a Batch Script

  1. Open Notepad.
  2. Paste this script:
    @echo off
    echo Deleting temp files...
    del /s /f /q %temp%\*
    del /s /f /q C:\Windows\Temp\*
    del /s /f /q C:\Windows\Prefetch\*
    rd /s /q %temp%
    md %temp%
    echo Done!
    pause
  3. Save it as cleanup_temp.bat.
  4. Right-click the file and choose Run as administrator.

FAQs

Is it safe to delete temp files in Windows 11?

Yes, it’s completely safe. Temp files are non-essential and are mainly used for caching or setup processes.

What happens if I delete all temp files?

You may free up storage space and improve performance. Some apps might recreate these files when needed, but no core system functions are affected.

Where are temp files stored in Windows 11?

Common locations include %TEMP%, C:\Windows\Temp, and the Prefetch folder.

How often should I delete temporary files?

Ideally, once every 1–2 weeks. You can automate this using Storage Sense or a batch script.

Can I delete temp files using Command Prompt?

Yes. Use del /q/f/s %TEMP%\* in an elevated Command Prompt to quickly delete temp files.

Wrapping up

That’s all you need to know to safely and efficiently delete your temporary files in Windows 11.

If you encounter any problems, we have a guide on what to do if temporary files aren’t deleting, so be sure to check it out.

For any additional questions or thoughts, do not hesitate to leave a comment in the section below.

More about the topics: files, Windows 11 guides

User forum

1 messages