Mysterious, hidden, and sometimes large.
Pagefile.sys is a file created by Windows to manage memory usage.
It takes special steps to remove it, but it’s not difficult. I have instructions.
The catch: you probably don’t want to.
Become a Patron of Ask Leo! and go ad-free!
Pagefile.sys is the Windows paging (or swap) file used to manage virtual memory. It’s used when a system is low on physical memory (RAM). Pagefile.sys can be removed, but it’s best to let Windows manage it for you.
When programs on the computer use a lot of RAM — perhaps even trying to use more than the machine actually has — some of its contents are written to the paging file. If the “paged out” memory is needed again, other RAM contents are written to disk — again in the paging file — and the previously-written information is read back in.
It’s where Windows juggles and keeps track of demands for a lot of memory.
Note that pagefile.sys is a “system” file. In order to see the file in Windows File Explorer, the option to “Show hidden files and folders” must be enabled, and “Hide protected operating system files” must be disabled.
Since the file is being used by Windows, even when it’s not actively paging memory, you can’t just delete it.
It’ll either tell you “permission denied”, “file in use”, or something similar. Extra steps are required.
Playing with virtual memory
You may notice pagefile.sys is roughly the same size as your configured virtual memory settings. That’s a clue.
This leads to our first way to get rid of it: set your Virtual Memory to zero, and reboot. Once you return, Windows will no longer be using the file, and will let you delete it. (You may need to use an administrative command prompt to do it.)
If you have enough RAM in your system to handle the amount of memory needed to run the programs you use, you may not need virtual memory at all. I often run with no virtual memory configured, and no pagefile.sys present on my drive.
Note, however, that pagefile.sys will return if you re-enable virtual memory.
Playing with a different operating system
The other approach to deleting pagefile.sys is less useful, but I’ll include it to be complete.
Boot into another operating system and delete the file.
If you boot from a Linux “Live” DVD and explore your Windows hard drive, you’ll find, and should be able to delete, pagefile.sys.
We’ve done exactly what you asked for, but there’s a problem.
As soon as you boot Windows, as long as you have virtual memory enabled, pagefile.sys will return.
My recommendation: let Windows manage the file
Unless you have a reason to adjust your virtual memory settings or know you can run without virtual memory at all, I suggest leaving the settings, and pagefile.sys, the way they are. Given today’s large hard disks, the amount of space taken by pagefile.sys is generally small in comparison.
Now, hiberfil.sys, on the other hand, might be worth removing. Those instructions are here: What Are Hiberfil.sys and Pagefile.sys, and How Do I Remove Them?
Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.
I'll see you there!