Pagefile.sys is a file created and used by Windows to manage memory usage.
It takes some special steps if you want to remove it, but it’s not really difficult.
The catch is, you probably don’t want to.
Become a Patron of Ask Leo! and go ad-free!
Pagefile.sys is the Windows paging file, also known as the swap or virtual memory file. It’s a file Windows uses as Virtual Memory. Virtual Memory is disk space Windows uses when it runs out of physical memory, or RAM.
When the computer is using a lot of RAM — perhaps trying to use more RAM than the machine actually has — some of its contents are written to the paging file. If that “paged out” memory is needed again, other RAM contents are written to disk to make room, again in the paging file, and the previously-written information is read back in.
It’s how your computer juggles a lot of demands for memory. Pagefile.sys is the file where Windows keeps track of it.
Note that pagefile.sys is a “system” file. In order to see the file in Windows File Explorer, “Show hidden files and folders” must be enabled and “Hide protected operating system files” must be disabled.
Now, since the file is being used by Windows, 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 that pagefile.sys is roughly the same size as your configured virtual memory settings.
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 run Windows File Explorer as administrator 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. That happens to be how I often run.
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 for completeness: boot into another operating system and delete the file.
Quite literally, if you were to boot from a Linux “Live” CD, 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 configured, pagefile.sys will return.
Bottom line: let Windows manage the file
Unless you have some reason to play with your virtual memory settings, or know you can run without virtual memory at all, I suggest leaving the virtual memory 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.