Clear Pagefile at Shutdown via Registry Editor
The Windows paging file (pagefile.sys) acts as an
extension of physical RAM, storing temporary memory data on your hard
drive or SSD. Because this file can retain sensitive information—such as
passwords, encryption keys, and unencrypted file data—clearing it upon
shutdown enhances system security and prevents unauthorized data
recovery. This guide provides a step-by-step walkthrough on how to
configure Windows to automatically overwrite and purge the paging file
every time your computer shuts down using the Windows Registry Editor
(Regedit).
Step 1: Open the Registry Editor
- Press the Windows Key + R shortcut to open the Run dialog box.
- Type
regeditinto the field and press Enter or click OK. - If prompted by User Account Control (UAC), click Yes to grant administrative permissions.
Step 2: Navigate to the Memory Management Key
In the Registry Editor address bar at the top, paste the following path and press Enter, or navigate manually using the left sidebar:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Step 3: Modify the ClearPageFileAtShutdown Value
- With the Memory Management folder selected on the left, look at the right pane to find the DWORD (32-bit) value named ClearPageFileAtShutdown.
- Double-click ClearPageFileAtShutdown to open its properties.
- In the Value data field, change the value from
0to1. - Ensure the Base is set to Hexadecimal, then click OK.
(Note: If the ClearPageFileAtShutdown value does not
exist, right-click an empty space in the right pane, select New
> DWORD (32-bit) Value, name it
ClearPageFileAtShutdown, and set its value data to
1.)
Step 4: Restart Your Computer
Close the Registry Editor and restart your computer to apply the new configuration.
Important Consideration
Enabling this feature instructs Windows to overwrite the entire
paging file with zeros during the shutdown process. As a result, your
computer may take slightly longer to power off completely, depending on
the size of your paging file and the speed of your storage drive. To
revert this setting in the future, repeat the steps and set the
ClearPageFileAtShutdown value back to
0.