Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › ClearPageFileAtShutdown

How to Clear the Windows Paging File at Shutdown (Microsoft’s Supported Method)

By Freedom251 Team · · 7 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To clear pagefile.sys when Windows shuts down, enable the Shutdown: Clear virtual memory pagefile security policy. Press Win+R, run secpol.msc, open Local Policies > Security Options, open the policy, select Enabled, and apply the change. Windows will clear the paging file during a normal shutdown; Microsoft says you do not need to restart after saving the policy.

What the setting does

Windows uses the paging file, normally C:pagefile.sys, as disk-backed virtual memory. Modified memory pages can be written there while the computer is running. Some of those pages may contain fragments of documents, credentials, encryption material, browser data, or other process information.

As an Amazon Associate I earn from qualifying purchases.

The policy controls whether Windows clears those pages during an orderly shutdown. In Microsoft’s wording, the setting determines “whether the virtual memory paging file is cleared when the device is shut down.” Clearing means Windows overwrites the paging-file contents rather than simply marking the file’s space as available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This is a data-remanence control. It is intended to reduce what someone could recover after the computer has been shut down and its system drive examined from another operating system or attached to another device. It is not a substitute for full-disk encryption, account protection, or physical security.

#1 Best Overall
Sale
CORSAIR Vengeance LPX DDR4 RAM 32GB (2x16GB) Up to 3200MHz CL16-20-20-38 1.35V Intel XMP AMD EXPO Computer Memory – Black (CMK32GX4M2E3200C16)
  • Disclaimer: Maximum Speed requires overclocking/PC BIOS adjustments. Maximum speed and performance depend on system components, including motherboard and CPU
  • Hand-sorted memory chips ensure high performance with generous overclocking headroom
  • VENGEANCE LPX is optimized for wide compatibility with the latest Intel and AMD DDR4 motherboards
  • A low-profile height of just 34mm ensures that VENGEANCE LPX even fits in most small-form-factor builds
  • A solid aluminum heatspreader efficiently dissipates heat from each module so that they consistently run at high clock speeds

Before you enable it

Understand the shutdown cost

Windows must overwrite the paging file, so shutdown time depends on the file’s size and the storage device’s write speed. Microsoft warns that clearing can take several minutes on large pagefiles and can make shutdown appear to hang. Its example says that a computer with 2 GB of RAM and a 2-GB paging file can take more than 30 minutes to shut down when the policy is enabled. That figure comes from Microsoft policy documentation published in 2016/2017, not a guarantee for every system.

Microsoft’s current 2026 shutdown-troubleshooting guidance also lists an enabled pagefile-clearing policy as a possible cause of shutdowns that stop responding for hours. A long delay is therefore often a consequence of the setting doing exactly what it was configured to do, although other blocked services or kernel problems still need investigation.

Keep the pagefile if Windows or your support process needs it

Do not delete or disable the pagefile just to avoid the shutdown delay. Microsoft explains that Windows’ commit limit combines physical RAM with pagefiles. Pagefiles can also be needed for crash dumps. A complete memory dump requires at least RAM + 257 MB of dump storage under Microsoft’s current sizing guidance.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If your organization needs crash dumps but does not want ordinary paging directed to a normal pagefile, Microsoft documents a dedicated dump file as an alternative. That is a design decision for administrators; it is different from removing virtual-memory support altogether.

Method 1: Enable the policy in Local Security Policy

This is Microsoft’s normal graphical procedure on editions that include the Local Security Policy console.

Rank #2
G.SKILL RipjawsV Series DDR4 RAM (XMP) 16GB (2x8GB) Up to 3200MT/s* CL16-18-18-38 1.35V Intel AMD Desktop Computer Memory U-DIMM - Black (F4-3200C16D-16GVKB)
  • Requires overclocking/BIOS adjustments. Maximum speed and performance depends on system components, including motherboard and CPU.
  • G.SKILL RipjawsV Series DDR4 U-DIMM Memory Kit, Model: F4-3200C16D-16GVKB
  • Non-ECC, DDR4 U-DIMM, 288-pin, for Desktop PC & Gaming
  • Includes JEDEC default profile, and Intel XMP memory overclock profile
  • Do not mix memory kits. Memory kits are sold in matched kits that are designed to run together as a set. Mixing memory kits will result in stability issues or system failure.
  1. Sign in with an administrator account, or be prepared to provide administrator approval.
  2. Press Win+R to open the Run dialog.
  3. Enter secpol.msc and press Enter.
  4. In the left pane, expand Local Policies.
  5. Select Security Options.
  6. In the right pane, locate Shutdown: Clear virtual memory pagefile.
  7. Open the policy, choose Enabled, and select Apply followed by OK.
  8. Close Local Security Policy.

The setting takes effect without a restart. The next normal shutdown will clear the paging file. A forced power-off, unplugging the machine, or a power failure does not provide the same orderly shutdown operation.

If the policy is missing

Local Security Policy is not exposed in every Windows edition. On managed computers, the setting may also be controlled by domain Group Policy. Microsoft’s policy reference places it at Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options. If a domain administrator manages the computer, a later policy refresh can replace a local choice, so ask the administrator to configure the effective domain policy instead of relying on a local edit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Method 2: Check or change the registry value

The policy is represented by a registry value at:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerMemory Management

The value is a REG_DWORD named ClearPageFileAtShutdown.

Value Meaning
0 Pagefile clearing disabled
1 Pagefile clearing enabled

Inspect the current state

  1. Press Win+R, type regedit, and press Enter.
  2. Approve the administrator prompt.
  3. Navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerMemory Management.
  4. Find ClearPageFileAtShutdown and read its data.

Export the Memory Management key before changing anything. A direct registry edit is an administrative change, and a domain policy can overwrite it. Use the policy editor where it is available; use the registry primarily to verify state or to manage a system through an established administrative process.

Change the value directly

  1. In Registry Editor, double-click ClearPageFileAtShutdown.
  2. Choose Decimal if you want to enter an easy-to-read number.
  3. Enter 1 to enable clearing or 0 to disable it.
  4. Select OK, then close Registry Editor.

The registry mapping documented by Microsoft is the same as the policy mapping. There is no need to create a second value if the named value already exists. If it is absent, use the policy interface or follow your organization’s standard registry-management procedure rather than guessing at additional settings.

Rank #3
A-Tech 16GB (2x8GB) DDR4 2666 MHz UDIMM PC4-21300 (PC4-2666V) CL19 DIMM Non-ECC Desktop RAM Memory Modules
  • Compatible with select DDR4 Desktop computers + Easy to install at home, no expertise required
  • Maximize your system's performance, boost loading speeds and multitask with ease
  • Backed by A-Tech's Lifetime Warranty + Friendly tech support team available to help before and after your purchase
  • 16GB RAM Kit ( 2 x 8GB Modules ) | DDR4 DIMM 288-Pin | Speeds up to 2666MHz (2667MHz), PC4-21300 / PC4-2666V
  • NON-ECC Unbuffered | 1Rx8 or 2Rx8 - Single or Dual Rank | JEDEC DDR4 standard 1.2V

What happens during shutdown

With the policy enabled, Windows processes the pagefile-clearing operation as part of a normal shutdown. It overwrites the paging-file pages, waits for the operation to finish, and then completes shutdown. The time required grows with the amount of paging-file space that must be processed and the sustained write performance of the disk.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A blank screen, a long “Shutting down” message, or a machine that appears inactive does not by itself prove that Windows is frozen. Interrupting power during the operation defeats the orderly-shutdown assumption and can create a separate recovery problem. If a system remains unresponsive far beyond the expected storage time, investigate it rather than repeatedly forcing power off.

Security benefits and limits

What it helps prevent

After an orderly shutdown, clearing reduces the chance that residual pages in the paging file can be inspected by someone who can remove the system drive, boot another operating system, or otherwise read the disk outside the installed Windows environment. This matters most for computers that may be lost, stolen, serviced by an untrusted party, or physically accessible to people who should not read the previous session’s data.

What it does not prevent

Microsoft explicitly warns that an attacker with physical access could bypass this countermeasure by unplugging the computer from its power source. The policy also does not erase data from other locations such as documents, application caches, hibernation data, backups, free space, or removable media. It does not protect a running or unlocked computer, and it does not replace encryption.

  • Full-disk encryption: protects data at rest when the device is powered off or locked, provided keys are properly protected.
  • Access controls: limit who can sign in and what they can read while Windows is running.
  • Physical controls: reduce the chance of tampering, drive removal, or forced power interruption.
  • Pagefile clearing: reduces residual data in one specific file after a normal shutdown.

Use the pagefile policy as one layer in a security design, not as a secure-erasure guarantee.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Crucial 16GB DDR4 RAM Kit (2x8GB), 3200MHz (PC4-25600), Downclockable to 2933/2666MHz Laptop Memory SODIMM 260-Pin, Compatible with 13th Gen Intel Core and AMD Ryzen 7000 - CT2K8G4SFRA32A
  • Boosts System Performance:16GB DDR4 laptop memory RAM kit (2x8GB) that operates at 3200MHz to improve multitasking and system responsiveness for smoother performance
  • Easy Installation: Upgrade your laptop RAM with ease—no computer skills required Follow step-by-step how-to guides available at Crucial for a smooth, worry-free installation
  • Compatibility Guaranteed: Ensure seamless compatibility with your laptop by using the Crucial System Scanner or Crucial Upgrade Selector—get accurate recommendations for your specific device
  • Trusted Micron Quality: Backed by 42 years of memory expertise, this DDR4 RAM is rigorously tested at both component and module levels, ensuring top performance and reliability
  • ECC Type = Non-ECC, Form Factor = SODIMM, Pin Count = 260-pin, PC Speed = PC4-25600, Voltage = 1.2V, Rank and Configuration = 1Rx16, 1Rx8 or 2Rx8
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing the right setting for your computer

Situation Usually reasonable approach Main trade-off
Physically exposed kiosk, field device, or high-security workstation Enable the policy and test shutdown behavior Shutdown can become substantially slower
Interactive desktop with frequent restarts Consider leaving it disabled and rely on encryption and physical controls Residual pages remain until overwritten by normal system activity
Server with strict uptime or maintenance targets Measure the delay during a maintenance window before enabling Long shutdowns can disrupt operations
System that requires complete memory dumps Retain adequate dump storage or design a dedicated dump file Storage and configuration complexity remain necessary

The decision should weigh three things: residual-data exposure, acceptable shutdown time, and diagnostic requirements. A policy that is technically enabled but routinely bypassed with forced power-offs may not deliver the intended protection.

Troubleshooting slow or apparently stuck shutdowns

Shutdown became slow immediately after enabling the policy

  • Confirm that ClearPageFileAtShutdown is set to 1.
  • Check the configured pagefile size in Windows’ virtual-memory settings.
  • Compare the delay with the storage device’s sustained write performance.
  • Allow a complete shutdown once before concluding that the machine is frozen.

A large pagefile on slower storage can make the delay predictable and repeatable. Reducing the pagefile solely to shorten shutdown can affect commit capacity and dump support, so make that change only after checking workload and diagnostic requirements.

Shutdown appears to hang for hours

Microsoft’s 2026 troubleshooting guidance includes pagefile clearing among possible causes, but it also points to blocked services and kernel conditions. Check the registry or effective policy state, then review shutdown and system events, recently installed drivers, services that fail to stop, and storage errors. Do not assume every long shutdown is caused by the pagefile.

The local value says enabled, but behavior does not match

On a domain-managed computer, the effective Group Policy setting takes precedence over a local preference. Verify the applied policy with your organization’s management tools and ask the administrator which policy object is authoritative. A local registry value alone is not proof that the setting will remain in force.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You need crash dumps after enabling clearing

Keep the dump design separate from the privacy decision. Verify that the configured dump type has enough storage, remembering Microsoft’s complete-dump baseline of RAM plus 257 MB. If ordinary paging is undesirable, evaluate Microsoft’s dedicated dump-file option rather than deleting every pagefile.

How to verify the change safely

  1. Record the current policy or registry state before making changes.
  2. Enable the policy during a planned maintenance window.
  3. Perform one normal shutdown and measure the elapsed time.
  4. Start Windows again and confirm that required applications, services, and diagnostics still operate.
  5. Review the effective policy on managed computers after Group Policy refresh.
  6. If the delay is unacceptable, set the policy to Disabled or restore registry value 0, then test another normal shutdown.

Testing on the actual hardware matters because Microsoft’s “more than 30 minutes” example is tied to a specific 2-GB RAM and 2-GB pagefile configuration. Your pagefile size, disk type, encryption, storage health, and workload can produce a very different result.

Bottom line

Microsoft’s supported control is Shutdown: Clear virtual memory pagefile in Local Security Policy. Enable it at Win+R > secpol.msc > Local Policies > Security Options when reducing pagefile remnants after normal shutdown justifies the potentially long wait. Keep the pagefile and crash-dump requirements intact, and pair the setting with encryption and physical protections because it cannot defend against forced power loss or other forms of physical access.

Quick Recap

SaleBestseller No. 1
Bestseller No. 2
G.SKILL RipjawsV Series DDR4 RAM (XMP) 16GB (2x8GB) Up to 3200MT/s* CL16-18-18-38 1.35V Intel AMD Desktop Computer Memory U-DIMM - Black (F4-3200C16D-16GVKB)
G.SKILL RipjawsV Series DDR4 RAM (XMP) 16GB (2x8GB) Up to 3200MT/s* CL16-18-18-38 1.35V Intel AMD Desktop Computer Memory U-DIMM - Black (F4-3200C16D-16GVKB)
G.SKILL RipjawsV Series DDR4 U-DIMM Memory Kit, Model: F4-3200C16D-16GVKB; Non-ECC, DDR4 U-DIMM, 288-pin, for Desktop PC & Gaming
$134.99
Bestseller No. 3
A-Tech 16GB (2x8GB) DDR4 2666 MHz UDIMM PC4-21300 (PC4-2666V) CL19 DIMM Non-ECC Desktop RAM Memory Modules
A-Tech 16GB (2x8GB) DDR4 2666 MHz UDIMM PC4-21300 (PC4-2666V) CL19 DIMM Non-ECC Desktop RAM Memory Modules
Maximize your system's performance, boost loading speeds and multitask with ease; NON-ECC Unbuffered | 1Rx8 or 2Rx8 - Single or Dual Rank | JEDEC DDR4 standard 1.2V
$113.86

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ClearPageFileAtShutdownLocal Security Policypagefilepaging filesystem administrationWindowsWindows Security

Leave a Reply

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

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.