How to Clear the Pagefile with Every Shutdown in Windows 10

The Pagefile is one of the oldest and most important features in Windows. It acts as a virtual memory on your Windows system. Whenever your machine is low on memory, Windows moves the least used memory pages to a hidden file called pagefile. By default, the pagefile is automatically created and maintained by Windows itself. This enables Windows to run programs as it should without crashing them due to low memory. Even if you have plenty of memory, Windows still uses the pagefile for caching when moving or deleting a large amount of files and for other activities.

As most of you know, whenever you shut down your system, the contents of the memory (RAM) are automatically lost due to the loss of power. But when it comes to the pagefile, the content stays intact unless Windows removes them. This makes it possible for others to probe for data in the pagefile. If you don’t want this to happen, you can force Windows to automatically clear the pagefile every time you shut down Windows.

Related: How to change the pagefile’s size and location in Windows.

When you make Windows automatically clear the pagefile with every shutdown, it will actually overwrite the existing pagefile data with “zeros.” This makes it near impossible to recover data from the pagefile. However, because of the rewriting process, the time to shut down your system may increase.

If you are using the Pro or Enterprise version of Windows, then you can use the Group Policy Editor to clear the pagefile automatically. To start, search for gpedit.msc in the Start menu and open it.


The above action will open the Group Policy Editor. Here, navigate to “Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options” on the left panel.


On the right panel, find and double-click on the “Shutdown: Clear virtual memory page file” policy.


In the policy settings window, select the “Enabled” radio option, and then click on the “OK” button to save the changes.


Then just restart your system to make the changes take effect and you are good to go. If you ever want to revert back, simply select the “Disabled” radio option in the policy settings window.

If you are using the Home version of Windows, then you have no choice but to use the Windows Registry to clear the pagefile. To do that, search for regedit in the Start menu and open it.

Once the Registry Editor has been opened, navigate to the following key on the left pane:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management


Here we need to create a new value. To do that, right-click on the right panel and select the option “New > DWORD (32-bit) Value.”

Now, name the new value as “ClearPageFileAtShutdown” and press the Enter button.

After creating the value, double-click on it to open the value properties window. Here, enter “1” as the new Value Data, and click on the “OK” button to save the changes.


This is how it looks once you are done with the changes.


Restart your system to make sure the changes take effect. From this point forward, whenever you shut down your system, Windows will automatically clear the pagefile.

In the future to revert back, simply change the value data back to “0” and you are good to go.

Do comment below sharing your thoughts and experiences about using the above method to automatically clear the pagefile in Windows with every shutdown.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.