What Is pagefile.sys? Virtual Memory in Windows Explained

What pagefile.sys does, how much of it you use, how to resize or move it, and why disabling the pagefile is usually a mistake.

Open File Explorer, show hidden and protected system files, and you will find a large file in the root of your C: drive called pagefile.sys. It is often several gigabytes, and it is one of the most misunderstood files in Windows. This guide explains what the pagefile does, how big it should be, and why you should almost never turn it off.

What Is pagefile.sys? Virtual Memory in Windows Explained

1. What the pagefile actually is

Windows gives every program a large private address space, called virtual memory. Only part of it is backed by physical RAM at any moment. When RAM fills up, Windows moves memory pages that have not been used recently out to disk, into the pagefile, and gives the freed RAM to whatever needs it now. If a program touches one of those pages again, Windows reads it back in. This is called paging.

The pagefile has a second job that is easy to miss. Windows only lets programs commit as much memory as RAM plus the pagefile can back. This total is the commit limit. If you shrink or remove the pagefile, you lower that ceiling. Apps can then fail with “out of memory” errors even when Task Manager shows free RAM.

2. pagefile.sys, swapfile.sys and hiberfil.sys

You may see three similar files on the system drive. They do different things:

File Purpose Safe to remove?
pagefile.sys Virtual memory for desktop apps and crash dumps Not recommended
swapfile.sys Used by Store (UWP) apps to suspend and resume quickly Managed together with the pagefile
hiberfil.sys Holds memory contents for hibernate and Fast Startup Yes, with powercfg /hibernate off, but you lose both features

3. Check how much of the pagefile you use

Before changing anything, check real usage. Open PowerShell and run:

Get-CimInstance Win32_PageFileUsage | Select-Object Name, AllocatedBaseSize, CurrentUsage, PeakUsage
PowerShell output of Win32_PageFileUsage showing pagefile size and usage

All values are in megabytes. AllocatedBaseSize is the current size of the file, CurrentUsage is how much is in use right now, and PeakUsage is the highest it has reached since the last restart. You can also see the commit charge in Task Manager > Performance > Memory, under Committed, shown as used / limit.

4. How to change the pagefile size

For almost everyone, the right setting is to let Windows manage it. If you need to move it to another drive or set a fixed size:

Windows Virtual Memory dialog with automatic paging file size option
  1. Press Win + R, type sysdm.cpl and press Enter.
  2. On the Advanced tab, under Performance, click Settings.
  3. Open the Advanced tab again and click Change under Virtual memory.
  4. Clear Automatically manage paging file size for all drives.
  5. Select a drive, choose Custom size or System managed size, click Set, then OK, and restart.

If you set a custom size, make the maximum at least as large as your peak commit charge, with some headroom. Keep at least a small pagefile on C: if you want Windows to write memory dumps after a blue screen.

5. Should you disable the pagefile?

This advice is common, but you should not follow it. With no pagefile, Windows has to keep every unused page in RAM, the commit limit drops to the size of RAM, and some apps and games refuse to run or crash under load. You also lose crash dumps, which makes it harder to diagnose blue screen errors. On an SSD, normal paging activity is light and does not meaningfully shorten drive life.

If the pagefile is causing constant disk activity, the real problem is too little RAM for your workload, or a program leaking memory. See how to fix 100% disk usage for ways to track it down. If space is the issue, try the steps in free up disk space in Windows 11 first.

Key takeaways

  • The pagefile extends RAM and sets the commit limit, so it matters even on PCs with lots of memory.
  • System managed size is the best choice for most users.
  • Disabling it saves disk space but risks crashes and removes crash dumps.
  • Heavy paging means you need more RAM, not a smaller pagefile.

More guides

Recently published on appsforwin10.