Modern Windows versions, such as 11, 10, 8.1, and 8, have three weird files stored on drive C. Those files are pagefile.sys, hiberfil.sys, and swapfile.sys. All three files are notably large, which causes an unprepared user to consider deleting swapfile.sys and its “siblings” to reclaim some storage on drive C. This is a particularly relevant question for users with smaller SSD drives they use for Windows. This article will answer your “What is swapfile.sys file in Windows 10?” question and a similar request, such as “How to delete swapfile.sys in Windows 10?.” It also applies to Windows 11 and older releases.
Note that you may not see the swapfile.sys file on your drive C right away. It is a system file that Windows protects from overly curious users who tend to Shift+Delete anything they do not recognize. Therefore, here is where to find the swapfile.sys file in Windows 10 and 11:
- Open File Explorer and click View > Folder Options. If you use Windows 11, click the button with three dots and select Options.
- Go to the View tab and select Show hidden files, folders, and drives.
- Also, disable the Hide protected operating system files (Recommended) option.
Now you can see your pagefile.sys, hiberfil.sys, and swapfile.sys files.
Table of Contents
What is swapfile.sys in Windows 10 and 11?
The three sys files on drive C are responsible for hibernation and memory paging. The hiberfil.sys is for hibernation—that is where Windows saves its current state when you put your computer to hibernation. You cannot delete the file using traditional methods (Delete or Shift+Delete)—the only way to remove the hiberfil.sys is to disable hibernation.
The pagefile.sys is a virtual memory, or memory paging file Windows uses when running out of RAM. Finally, the swapfile.sys is similar to pagefile.sys. Its primary purpose is to “cache” UWP applications you install from the Microsoft Store. Windows 10 and 11 use the swapfile.sys file even when they have enough RAM to operate.
Another noteworthy fact is that pagefile.sys and swapfile.sys are tied together, and you cannot delete one and leave the other.
Can I Delete the Swapfile.sys in Windows 10 and 11?
Yes, you can. However, you probably should not do that. For starters, it does not take much space on your drive. Therefore, you can reclaim some of the lost storage using other methods. Secondly, the swapfile.sys file is tied to pagefile.sys, which means deleting swapfile.sys requires disabling the virtual memory feature. We strongly recommend not doing that, especially on systems with 16GB or less memory. Disabling virtual memory might give back a few GB on drive C but also result in apps crashing and instabilities during memory-intensive tasks.
Still, if you are 100% sure you want to delete the swapfile.sys file in Windows 10 and 11, here is how to do that.
Again, we strongly recommend you not deleting the swapfile.sys, especially if you use UWP apps from the Microsoft Store. If you do not use UWP apps, you could try removing swapfile.sys using the following methods.
Delete Swapfile.sys
No, you cannot select the swapfile.sys file and press Shift + Delete. Swapfile.sys is a system-protected object, and Windows will not allow simply putting it into Recycle Bin. Changing ownership will not help either. The only proper way to delete swapfile.sys in Windows 10 and 11 is to disable the virtual memory feature.
- Open File Explorer and right-click This PC in the navigation pane.
- Select Properties.
- Click Advanced System Settings.
- Alternatively, press Win + S and type Advanced System Settings. Windows will return a link to the Control Panel, and the section we need to delete swapfile.sys in Windows 10 and 11.
- Click Settings in the Performance section on the Advanced tab.
- In a new window, go to the Advanced tab (yes, again) and locate the Virtual memory section.
- Click Change.
- Uncheck the Automatically manage paging file size for all drives option.
- Click No paging file.
- Click Set.
- Click Ok to save the changes.
Restart your computer. Note that you need to select the Restart option, not Shutdown since Windows 10 and 11 use Startup and hybrid power off state by default to speed up the boot process.
Another Way to Delete Swapfile.sys in Windows 10 and 11
You can try deleting swapfile.sys without disabling the virtual memory feature. Note that this is a risky procedure that involves modifying Windows Registry. We recommend creating a system restore point to back up the registry and ensure you can restore your operating system in case something goes horribly wrong.
Warning. The following procedure requires Administrator privileges. Windows will ask for the administrator password when attempting to open the registry editor from a profile without the necessary privileges.
- Press Win + R and type regedit. This is the fastest way to launch Windows Registry editor.
- Click the address path and paste in it the following: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
- Click Edit > New > DWORD (32-bit) value.
- Rename the new value to SwapfileControl.
- Open the new value and change its value data to 0.
- Restart your computer and go to drive C to see if the swapfile.sys is still there.
If you are not comfortable with browsing the registry and adding values manually, run Power Shell or Windows Terminal as Administrator and execute the following command:
New-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management” -Name SwapfileControl -Value 0 -PropertyType DWORD -Force
The command automates steps 1-5 and does everything for you.
To revert the changes, repeat steps 1 and 2 and then delete the SwapfileControl value and restart your computer.
How to Move Swapfile.sys to Another Drive?
Some users want to move swapfile.sys and pagefile.sys to another physical drive (primarily HDD) to reduce wear on their SSDs. While it is debatable whether swapfile.sys and pagefile.sys harm your SSD’s health, here is how to move swapfile.sys to another drive.
Note. Moving swapfile.sys to a slower physical drive might result in notable performance slowdowns in UWP applications.
- Open File Explorer and right-click This PC in the navigation pane.
- Select Properties.
- Click Advanced System Settings.
- Alternatively, press Win + S and type Advanced System Settings. Windows will return a link to the Control Panel, and the section we need to delete swapfile.sys in Windows 10 and 11.
- Click Settings in the Performance section on the Advanced tab.
- In a new window, go to the Advanced tab and locate the Virtual memory section.
- Click Change.
- Uncheck the Automatically manage paging file size for all drives option.
- Click No paging file.
- Click Set.
- Agree to the warning.
- Select the drive you want from the list at the top of the window.
- Click System managed size.
- Click Set.
- Click Ok.
That is it. Now pagefile.sys and swapfile.sys sit on another drive.