Many who have tried to free up space in Windows 10 will have come across an abnormally large file and instantly wondered how to delete pagefile.sys. The paging file in Windows 10 can take up to 32 GB and is usually a significant storage drain on small SSDs.
What is pagefile.sys used for in Windows and can I delete pagefile.sys?
Before you do anything drastic, it's worth explaining exactly what the pagefile is. The paging file in Windows 10 is a form of virtual memory, often used when you open an app and your PC already has more apps than it can handle. When the new program starts, the old ones are essentially backed up from the RAM to your hard drive to make sure you don't lose any information when they're pushed out of RAM.
This is a useful feature and many crash logs are stored in the paging file, but it can also be a small security vulnerability. By default, pagefile.sys retains information after the computer is shut down, which can potentially give an attacker more information than you intend.
As a result, we're going to be showing you how to delete pagefile.sys on shutdown. However, note that we won't be covering how to delete pagefile.sys permanently today. For that, you can check our previous tutorial about optimizing virtual memory. Let's get started:
How to Delete Pagefile.sys on Shut Down via Registry Entry
Remember that editing your registry can be dangerous if you don't take precautions. Please read our safe Registry editing guide before you continue.
- Open Registry Editor
Press the “Windows” key and search for “registry editor” click the top result to open it. - Navigate to the memory management Registry key
In your Registry Editor address bar, paste:Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
- Enable the “ClearPageFileAtShutDown” entry
After selecting the Memory Management folder, search for a DWORD named “ClearPageFileAtShutdown” and double click it. Change its “Value data” to “1” and press “OK”. Restart your PC to check if the page file resets.
How to Delete Pagefile.sys on Shutdown with an Automatic .Reg File Entry
Those who trust we have their best interests at heart can skip the manual registry entry and use our pre-configured .reg file to do it for them. You can download it here. Extract it before continuing.
- Run the .reg file
Enter the folder you extracted the .zip in and double-click “delete Pagefile.sys on shutdown.reg” to enable its removal on shutdown, or “keep Pagefile.sys on shutdown.reg” if you need to reverse it. - Accept the UAC prompt
- Click “Yes”
- Press “OK”
Your Windows 10 PC will now delete pagefile.sys on shutdown. Restart it to make sure it's functioning correctly.
If you found this tutorial helpful, you may also want to check out our guide on how to clean up the WinSxS folder and how to delete Windows Log Files.