For Windows PCs and laptops, there is a lot of confusion over pagefile.sys. We explain what this file is for and whether you can remove it.
What is pagefile.sys?
Windows uses pagefile.sys for storing the data that would otherwise be in the computer's random access memory (RAM). Sometimes there simply isn't enough capacity to hold all the necessary files in RAM, so pagefile.sys sits on your hard drive or SSD (C:\pagefile.sys) ready to receive data as necessary, and typically the least-used files in RAM are 'paged' out to this file.
It also has another role: storing the information about the computer's state in case there's a crash or a power cut.
The size is set by Windows but you can alter it manually if you know what you're doing (and you will if you keep reading).
Your computer will prioritise using your RAM to store data because it's faster to read it from here compared to your hard drive. However, when your RAM becomes full, Windows moves some of the data from your RAM back to your hard drive within the page file.
So, although it takes up space on your drive, pagefile.sys is critical to Windows operation.
Can I remove pagefile.sys? How to delete pagefile.sys
You're probably reading this article because you want to get rid of the page file to free up some valuable space on your hard drive. Although pagefile.sys is found at C:\pagefile.sys, you won't see it unless you tell Windows Explorer to show hidden operating system files.
In Windows 10, you won't see it even if you uncheck the 'Hidden items' box in File Explorer: this is to stop you deleting it by accident.
And if you didn't skip straight to this section you'll know already you can't and shouldn't delete pagefile.sys. Doing so will mean Windows has nowhere to put data when physical RAM is full and will likely crash (or the app you're using will crash).
There are a couple of things you can do though. One is to move the file to another drive. For example, if you're trying to make space on an SSD, move pagefile.sys to a hard drive if you have one.
This shouldn't negatively impact performance, and could even speed up certain processes as the page file doesn't need to be backed up when the primary drive is replicated.
If you want to go ahead a delete it anyway, follow the steps below. After selecting 'no page file' reboot your computer and delete the file.
How to move pagefile.sys
Open Control Panel and search for 'advanced system settings' and select it from the list.
Now click Settings within the Performance section, which is on the Advanced tab.
Again, choose the Advanced tab in the window that opens and click the 'Change...' button under Virtual memory.
If you deselect 'Automatically manage paging file size of each drive' you can set C: to 'No paging file' and choose another drive for 'System managed file'.
It's important to make sure you're moving the file to a different physical drive and not just a different partition on the same hard drive if you're doing it for performance.
How to resize pagefile.sys
You can resize the page file so that it takes up less space. However, if your computer doesn't have much physical memory, you may want to add more RAM first. For example, our Windows 10 system has only 8GB of RAM and the default page file is 12GB.
It only makes sense to reduce the size of the page file if we at least double the RAM capacity. Otherwise, the page file could be too small to accommodate all the memory pages it needs to store.
Follow the steps above (except for clicking on 'no page file' then do the following:
Deselect 'Automatically manage paging file size of each drive'.
Select the custom size option and choose how big you want the file to be.
To calculate the minimum size you need, you should keep an eye on the amount of Committed memory for a few days so you know the maximum your computer uses. You'll see this if you hit Ctrl-Shift-Esc to bring up the Task Manager, then click on Memory to see the details:
Then, multiply the maximum amount of committed memory by 1.2 and subtract the capacity of your physical RAM.
In our case, that's (19.5GB * 1.2) - 8GB = 15.4GB. That's actually larger than the default size of 12GB, which is why it's a good idea to upgrade your RAM if you want a small page file.