How to Clear Pagefile at Shutdown in Windows 10

Cpu Microchip Sys Computer Electronic Processor Icon

The pagefile is where virtual memory that the operating system is using is stored when the physical memory (RAM) is not enough to fit all the running apps and system demands. Windows 10 creates a special file pagefile.sys in the root of your system drive like all previous releases of the OS. You can clear the page file at shutdown for increased security. Here is how it can be done.

Clearing the page file on shutdown can be important if the PC is being used by another person. It is possible that the pagefile contains some sensitive data after you shutdown the OS. If you have a dual-boot system or someone with physical access to your computer, the data can be recovered from that file. When Windows 10 is running, it has exclusive access rights to that file, so none of the apps can read it. However if your entire partition is not encrypted by Windows BitLocker or a similar technology, nothing protects that file when the installed OS partition can be accessed by booting another system. In that case, you might want to wipe the page file on every shut down and replace your sensitive information with zeroes.

Note: Enabling this feature will cause shutdown and restart to take a little longer to finish however compared to hard disk drives, it should still be quick on SSDs.

Before proceeding, ensure that your user account has administrative privileges. Now, follow the instructions below.

To clear the pagefile at shutdown in Windows 10, do the following.

  1. Open Registry Editor.
  2. Go to the following Registry key:
     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

    Tip: See how to jump to the desired Registry key with one click.

    If you do not have such a key, then just create it.

  3. Here, create or modify a 32-bit DWORD value ClearPageFileAtShutdown. Note: Even if you are running 64-bit Windows, you still need to use a 32-bit DWORD as the value type.
    Set it to 1 to clear the pagefile at shutdown.
  4. Restart Windows 10 to apply the change and you are done.

Later, you can delete the ClearPageFileAtShutdown value to restore the default behavior.

Note: Enabling this on SSDs will increase the amount of data written to the SSD on every shut down or restart. The page file is usually quite large in size, so several gigabytes will be written to the SSD.

To save your time, I made ready-to-use Registry files. You can download them here:

Download Registry Files

Clear the pagefile at shutdown in Windows 10 using Local Security Policy

If you are running Windows 10 Pro, Enterprise, or Education editions, you can use the Local Security Policy app to configure the option mentioned above with a GUI.

  1. Press Win + R keys together on your keyboard and type:
    secpol.msc

    Press Enter.

  2. Local Security Policy will open. Go to Local Policies \ Security Options on the left.
  3. On the right, enable the policy option Shutdown: Clear virtual memory pagefile as shown below.

Tip: See How to move page file in Windows 10 to another disk.

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

9 thoughts on “How to Clear Pagefile at Shutdown in Windows 10”

  1. With 32GB or more of memory, a large paging file is not really needed and can be trimmed to the Windows recommended minimum of 800MB and is rendered unnoticeable on all but the smallest SSDs.

  2. Iam giving away my laptop to someone permanently. Its a lenovi thinkpad. If I take out the harddisk is it enough or do I need to take out the ram also to be on the safer side. My laptop had personal files in the harddisk. Kindly advise.

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.