How to Clear Pagefile at Shutdown in Windows 10

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.Clear Page File On Shutdown 1
  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:

    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.Clear Page File On Shutdown 2

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:


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

  1. Saeid

    How to clean it once?

  2. Jimmy S.

    Does it only apply to Windows 10 or can it be done on older versions? My PC has Windows 8.1, 7 and 10.

    1. Sergey Tkachenko Post author

      This trick works in all modern Windows versions including 7 and 8/8.1.

  3. DJ

    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.

  4. Mark

    Tried to use the secpol.msc comand run says can not find the program or it is not installed? so I used the reg files

  5. Shout Me Crunch

    Will it work If I Press Shift + Shutdown to clear that file?

  6. Zaz

    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.

    1. Sergey Tkachenko Post author

      pulling out the hard disk is enough.

    2. bruh

      pull the ram out as well-fragments of the ram can remain on it-possibly exposing your personal data


Leave a Reply

Your email address will not be published. Required fields are marked *