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.

How Windows Clears the Pagefile

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.

Using Windows Group Policy Editor

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.

Using Windows Registry Editor

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:


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.


  1. Couple questions:

    1. If I read the article correctly, my question is, if pagefile is some sort of of “backup” to Ram, and all Ram is removed at shutdown, why is the data still saved on pagefile? Why would Windows “empty the main garbage” can every night but leave the “little garbage bag” on the floor forever? Makes no sense to me at all.

    2. Is there some sort of compelling reason to go through all the steps to amend how pagefile works for us ordinary bloaks?? I mean, is the stuff on that file so critical that we should be like James Bond and eat the messages?

    3. Will changing pagefile come back to bite us later? Windows has proven that they don’t like us messing around with their cookie jar.

  2. 1> Windows doesn’t clear RAM. RAM is being cleared because there’s no power anymore to keep the data stored. RAM needs constant power, disk storage doesn’t. Therefore, when your computer powers off, RAM is cleared but disk storage (thankfully!) is not.

    2> No. It’s better to have your hard disk encrypted using BitLocker if you have the chance. What the average bloak should do before writing off a computer is ensuring the hard drive is erased.

    3> Nope not at all.

  3. How can i have windows clear the page file at shutdown but NOT overwrite it??? I have windows installed on an ssd and would not like to waste its write cycles.. thanks

Comments are closed.