When your Windows computer is running out of storage space, you may find yourself looking for ways to free up some of it, even if they're a bit unconventional. One of these unconventional methods you may come across is deleting the Pagefile.sys file. But before you consider deleting it, you should know what Pagefile.sys is and if you should delete it in the first place.

Here's what you need to know.

What Is Pagefile.sys?

Pagefile.sys is a system file in Windows set aside for your computer’s Random Access Memory (RAM), also known as physical memory. When your computer's RAM begins to run out of memory, it uses the pagefile to offload data it doesn't need, such as files and apps.

So how does your computer’s RAM decide when to offload data? Let’s use an app as an example of how this works.

Usually, when you minimize an app, Windows will leave it running in the background. However, it will keep its data in the RAM so it can quickly access them when needed.

Then, when you boot up a RAM-intensive app, Windows needs to make room for it within the RAM. As such, Windows will instruct your PC’s RAM to dump the minimized app’s program files into Pagefile.sys, so it can free up memory without losing data.

By default, Windows will store Pagefile.sys in the root folder of your local drive (C:).

When you need to use the minimized app again, Windows will read its data from the Pagefile.sys file. And you'll be none the wiser that it's compensating for its physical memory shortcomings with the help of your local drive.

Reading an app’s program files from Pagefile.sys is slower than reading them from RAM. The process is even slower when you're using a hard disk drive (HDD) instead of a solid-state drive (SDD). However, It’s faster than closing the app and then relaunching it.

How to Check the Size of Pagefile.sys

To prevent tampering with Pagefile.sys, Windows will hide it by default. If you want to see it, here’s what you should do.

  1. Press Win + E to open File Explorer.
  2. Click on This PC in the navigation pane on the left and double-click your local drive (C:) on the right to open it.
  3. Now you need to open Folder Options. On Windows 11, click the three vertical dots in the top menu and select Options. On Windows 10, click View in the top menu and then on Options.
    selecting options in the top menu of file explorer in windows 11
  4. Select the View tab in Folder Options and uncheck Hide protected operating system files (Recommended).
    The unhide protected os files option in folder options
  5. In the warning that pops up, click Yes.
  6. A bit further up, you see Hidden files and folders. Inside it, check the Show hidden files, folders, and drives radio button.
  7. Click OK to close Folder Options and apply the changes.
  8. Scroll down in your local drive, and you’ll be able to see Pagefile.sys.
    the pagefile.sys file in the root folder of the local drive

As you can see, the Pagefile.sys file is quite large, which makes many people think deleting it is a good idea when they're running out of storage space.

Should You Delete Pagefile.sys?

One scenario where it would be reasonable to delete Pagefile.sys to save disk space is if you have a lot of RAM. That way, it can store all the data it needs to keep apps running without needing to offload them. For the average Windows user, the minimum RAM size for this would be 16GB.

If you delete Pagefile.sys and your computer runs out of physical memory, your system will start to become sluggish. If the sluggishness gets too bad, Windows itself might even crash.

Also, you might notice some apps becoming slower or crashing as well. That’s because they have nowhere to put the data they need to operate properly since your computer’s RAM is full and there is no Pagefile.sys to pick up the slack.

So unless your physical memory needs aren’t greater than your installed RAM’s capacity, we recommend leaving Pagefile.sys alone.

How to Delete Pagefile.sys

Since Windows is constantly using Pagefile.sys, it will not allow you to delete it in File Explorer directly. In fact, if you selected the file and hit the Delete key, you will see the following message: "The action can't be completed because the file is open in another program."

deleting-pagefile-error

However, there’s another method you can use to delete the file and save some disk space. To do that, follow the steps below.

  1. Press Win + S to open Windows Search.
  2. Type sysdm.cpl in the search box and hit the Enter key to open the System Properties window.
    searching for sysdm.cpl in windows search
  3. Select the Advanced tab, and in the Performance section, click the Settings button.
    the system properties dialog box in windows
  4. In the Performance Options window, select the Advanced tab and click Change.
    the Perfomance Options window on Windows
  5. In the Virtual Memory window, uncheck the Automatically manage paging file size for all drives checkbox at the top.
  6. Click on the radio button for No paging file, and click the Set button on the right.
    the Virtual Memory window on Windows with the No paging radio button ticked
  7. You’ll get a warning from Windows. Click Yes to bypass it.
  8. Click on OK to close the Virtual Memory window and apply the changes.
  9. Restart your Windows computer for the changes to take effect.

When Windows boots back up, the OS will have no use for Pagefile.sys, and it will delete it from your local drive. It will also delete the Swapfile.sys along with it. If you don't know what that file is and its importance, please read our guide on what Swapfile.sys is and if you can delete it.

How to Restore Pagefile.sys

If you deleted Pagefile.sys and discovered that you're experiencing problems because of it, you can easily restore it. However, if the problems are so severe that Windows is constantly freezing or can't even boot up properly, you should try entering Safe Mode first. To do that, please check out guides on ways to boot into Safe Mode on Windows 11 and what is Safe Mode on Windows 10.

Now, to bring back Pagefile.sys, follow the steps below:

  1. Press Win + R to open Windows Run.
  2. In the text box, enter sysdm.cpl and then hit the Enter key to launch the System Properties window.
    opening the System Properties window using Windows Run
  3. Select the Advanced tab, and in the Performance section, click the Settings button.
  4. In the Performance Options window, select the Advanced tab and click Change.
  5. In the Virtual Memory window, make sure the Automatically manage paging file size for all drives checkbox at the top is checked.
  6. Click on OK to close the Virtual Memory window and apply the changes.
  7. Restart your Windows computer for the changes to take effect.

Once your computer boots up, and you go to the folder where Pagefile.sys is located, you will see that the file has returned, along with Swapfile.sys.

How to Resize Pagefile.sys

If deleting Pagefile.sys isn’t an option for you, consider resizing it instead. Here’s how to do that:

  1. Press Win + E to open File Explorer.
  2. In the Navigation Pane, right-click This PC and select Properties. On Windows 11, you will have to select Show more options first before you can see the Properties option.
  3. Click on the Advanced system settings link to open the System Properties window. On Windows 11, you will find the link on the right panel, while, on Windows 10, it will be on the left side menu.
    the About page of the System window in the Settings app on Windows 11
  4. Select the Advanced tab, and in the Performance section, click the Settings button.
  5. In the Performance Options window, select the Advanced tab and click Change.
  6. In the Virtual Memory window, uncheck the Automatically manage paging file size for all drives checkbox at the top.
  7. Click on the radio button for Custom size. Immediately, you’ll see that the two text boxes below it (Initial size and Maximum size) are no longer grayed out.
  8. Enter the appropriate page file sizes in megabytes (MB) in both text boxes and then click Set.
    the virtual memory dialog box on windows with the custom page file size set to 4096
  9. Click OK to close the Virtual Memory window and apply the changes.
  10. Restart your Windows computer for the changes to take effect.

Pagefile.sys, Demystified

Pagefile.sys is an extremely important file when it comes to keeping your Windows computer running smoothly. It helps give your PC's RAM more breathing room when physical memory can no longer hold more data. You can delete it, but only do so when you know your computer's RAM has enough capacity to stand on its own. If not, you’re better off just resizing Pagefile.sys so it doesn’t take up too much space.

If you’re unsure of what to do with Pagefile.sys, just leave it to Windows to handle the file and look for other ways to free up space on your storage drive.