HomeWinBuzzer TipsHow to Delete Pagefile.sys When Windows 10 Shuts Down

How to Delete Pagefile.sys When Windows 10 Shuts Down

We show you how to edit your registry to delete pagefile.sys each time your PC shuts down and increase security.


 Many who have tried to free up space in Windows 10 will have come across an abnormally large file and instantly wondered how to delete pagefile.sys. The paging file in Windows 10 can take up to 32 GB and is usually a significant storage drain on small SSDs.

What is pagefile.sys used for in Windows and can I delete pagefile.sys?

Before you do anything drastic, it’s worth explaining exactly what the pagefile is. The paging file in Windows 10 is a form of virtual memory, often used when you open an app and your PC already has more apps than it can handle. When the new program starts, the old ones are essentially backed up from the RAM to your hard drive to make sure you don’t lose any information when they’re pushed out of RAM.

This is a useful feature and many crash logs are stored in the paging file, but it can also be a small security vulnerability. By default, pagefile.sys retains information after the computer is shut down, which can potentially give an attacker more information than you intend.

As a result, we’re going to be showing you how to delete pagefile.sys on shutdown. However, note that we won’t be covering how to delete pagefile.sys permanently today. For that, you can check our previous tutorial about optimizing virtual memory. Let’s get started:

How to Delete Pagefile.sys on Shut Down via Registry Entry

Remember that editing your registry can be dangerous if you don’t take precautions. Please read our safe Registry editing guide before you continue.

  1. Open Registry Editor

    Press the “Windows” key and search for “registry editor” click the top result to open it.

    Windows 10 - Open Registry Editor

  2. Navigate to the memory management Registry key

    In your Registry Editor address bar, paste:

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

    Windows 10 - Registry Editor - CurrentControlSetControlSession ManagerMemory Management

  3. Enable the “ClearPageFileAtShutDown” entry

    After selecting the Memory Management folder, search for a DWORD named “ClearPageFileAtShutdown” and double click it. Change its “Value data” to “1” and press “OK”. Restart your PC to check if the page file resets.

    Windows 10 - Registry Editor - Memory Management - ClearPageFileAtShutDown

How to Delete Pagefile.sys on Shutdown with an Automatic .Reg File Entry

Those who trust we have their best interests at heart can skip the manual registry entry and use our pre-configured .reg file to do it for them. You can download it here. Extract it before continuing.

  1. Run the .reg file

    Enter the folder you extracted the .zip in and double-click “delete Pagefile.sys on shutdown.reg” to enable its removal on shutdown, or “keep Pagefile.sys on shutdown.reg” if you need to reverse it.

    Windows 10 - File Manager - ClearPageFileAtShutDown Download

  2. Accept the UAC prompt

    Windows 10 - File Manager - ClearPageFileAtShutDown Download - UAC

  3. Click “Yes”

    Windows 10 - Registry Editor - Confirmation

  4. Press “OK”

    Your Windows 10 PC will now delete pagefile.sys on shutdown. Restart it to make sure it’s functioning correctly.

    Windows 10 - Registry Editor - Success

If you found this tutorial helpful, you may also want to check out our guide on how to clean up the WinSxS folder and how to delete Windows Log Files.

Ryan Maskell
Ryan Maskellhttps://ryanmaskell.co.uk
Ryan has had a passion for gaming and technology since early childhood. Fusing the skills from his Creative Writing and Publishing degree with profound technical knowledge, he enjoys covering news about Microsoft. As an avid writer, he is also working on his debut novel.
Table of Contents: