How to set Windows to automatically delete Pagefile.sys

What is Pagefile.sys?

Pagefile.sys is a Windows system file used as RAM substitute. In other words, this file functions as virtual RAM that is used for programs that arent currently in use. Its main purpose is to improve the overall performance of the machine by taking some of the heat off its actual RAM so that the latter can be directed towards processes of higher priority. If a given app requires more RAM than you actually have, Windows will engage the Pagefile.sys.


Since Pagefile.sys is an actual file stored on your hard-drive, it takes up some space. Its size is typically one and a half times the size of your computers RAM (at least that is the recommended minimum size of the file). The maximum size is three times the amount of RAM on your machine. This means that on a machine that has 12GB of RAM, the size of the Pagefile.sys would normally be anywhere between 18GB and 36GB! Apparently, this file could be quite big and take quite some storage space. Modern computers typically have big hard-drives but if you are using SSD instead of HDD, then your storage may not be as spacious. Many computers are optimized towards gaming and so they have lots of RAM (which means a bigger Pagefile.sys) and dont have all that much storage due to the use of SSD instead of HDD. This means that Pagefile.sys might actually have quite an impact on the percentage of free space on the computer. Now, this file is very important and so not only is it rather tricky to delete it but it is also highly inadvisable to go out of your way to get rid of this file. That being said, theres still a way to safely reduce the amount of space this file takes up on your computer (or at least during the time the machine is shut down).

You see, you can set Windows to automatically delete this file when shutting down. This wont fully get rid of the file (nor should it) but it will make the file temporarily disappear when the computer is turned off. If you opt for this, the time your computer needs to shut down will be increased so dont b surprised if your PC begins to take longer to power down.

How to set Windows to automatically delete Pagefile.sys upon shutdown

Important!: The following steps involve editing the computers Registry. Only proceed if you are confident you can correctly complete all the steps. Any unintended changes in the Registry could cause long-lasting issues for your computer. Just to be safe, its best to backup your Registry before continuing.

  1. Press the Winkey + R keys and in the Run dialog box that opens, type regedit.
    7 4
  2. Hit Enter to open the Registry Editor and click OK if asked whether you want to allow the program to make changes to the computer.
  3. In the Registry Editor, navigate to the following folder: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management.
  4. Select the Memory Management folder and, in the right panel, double-click on the ClearPageFileAtShutDown file (should be the second item).
  5. Normally, the number next to Value Data should be 0 – set it to 1 and click on OK.

After you complete this short guide, your computers Pagefile.sys will no longer be stored after the computer gets shut down. However, while your machine is turned on and being used, the file will be present on it an will still be taking up space so its important to never allow yourself to such a storage space deficit that you cannot afford to keep this file. In general, it is not advisable to keep your computer filled with too much data anyway so if you think that you may not have enough free storage space available, it might be a good idea to delete some stuff or, if everything on the computer is important, at least relocate some of the files (ones you dont need to use frequently) to an external drive or to a cloud storage.


About the author


Brandon Skies

Brandon is a researcher and content creator in the fields of cyber-security and virtual privacy. Years of experience enable him to provide readers with important information and adequate solutions for the latest software and malware problems.

Leave a Comment