Windows 11 Page File Optimization: Best Settings by RAM
Few Windows settings spark more debate than the page file. The “just disable it with 32 GB of RAM” crowd and the “always let Windows manage it” camp both make reasonable-sounding arguments, but neither represents the optimal configuration for a gaming PC. The reality is more nuanced: the page file still matters even with 64 GB of RAM, and how you configure it directly affects system stability and performance under pressure.
What Is the Page File?
The page file (pagefile.sys in the root of your system drive) is a hidden system file that Windows uses as an extension of physical RAM. When physical RAM fills up, Windows can move cold pages (memory pages that have not been accessed recently) from RAM to the page file, freeing physical RAM for active workloads. When those cold pages are needed again, Windows reads them back from disk — this is a page fault.
The page file also serves a second, often overlooked purpose: crash dump storage. When Windows crashes (BSOD), it writes a memory dump for diagnostics. If the page file is absent or too small, Windows may not be able to write a useful dump, making crash analysis impossible.
Page File vs. Swap File
Windows 11 maintains two related files:
- pagefile.sys: The traditional page file for general virtual memory.
- swapfile.sys: A newer file used specifically for Universal Windows Platform (UWP) apps to swap their memory. This file is small (< 256 MB) and is always required; it cannot be usefully disabled.
System-Managed vs. Custom Page File
Windows offers two modes:
System-Managed: Windows dynamically sizes the page file based on installed RAM. The formula is roughly 1.5× RAM as minimum, up to 3× RAM as maximum. On a 32 GB system this means Windows might allocate up to 96 GB on disk — usually overkill.
Custom Size: You set initial and maximum sizes manually. The initial size determines how much disk space is pre-allocated (contiguous on disk, better performance). The maximum determines the upper bound Windows can use in emergencies.
Accessing Page File Settings
Win + R → sysdm.cpl → Advanced → Performance → Settings → Advanced → Change
Or via PowerShell to check current configuration:
Get-WmiObject -Class Win32_PageFileSetting | Format-List Name, InitialSize, MaximumSize
Get-WmiObject -Class Win32_PageFileUsage | Format-List Name, CurrentUsage, PeakUsage, AllocatedBaseSize
PeakUsage is the most useful value — it tells you the maximum page file usage during the current session.
Recommended Settings by RAM Amount
| RAM Installed | Initial Size | Maximum Size | Notes |
|---|---|---|---|
| 8 GB | 8192 MB | 12288 MB | Windows will use it heavily; do not disable |
| 16 GB | 4096 MB | 8192 MB | Balance between memory pressure relief and disk space |
| 32 GB | 2048 MB | 4096 MB | Primarily for crash dumps; minimal active use |
| 64 GB+ | 2048 MB | 2048 MB | Fixed size; prevents fragmentation, holds dump data |
Setting initial = maximum creates a fixed-size page file. This prevents Windows from resizing it on-the-fly (which causes disk writes during gaming) and ensures it remains contiguous on an SSD, reducing fragmentation.
Should You Disable the Page File?
No — not even with 64 GB of RAM. Here is why:
- Driver and kernel allocations: Some kernel components and drivers allocate memory from the “paged pool,” which can spill to the page file. Without a page file, these allocations fail with a system crash.
- Crash dumps: Without a page file, automatic memory dumps cannot be written. BSODs become undiagnosable.
- Application compatibility: Some applications check for available virtual memory (RAM + page file) before running and refuse to start if the virtual memory pool looks insufficient.
If you have 32 GB or more and experience zero performance benefit from a page file, you can set it to a small fixed value (2 GB) rather than disabling it entirely. This keeps the dump and kernel pool benefits while consuming minimal disk space.
SSD vs. HDD Page File Placement
On a system with both an SSD and an HDD:
Put the page file on the SSD. Here is why:
- SSD random read latency: ~0.1 ms
- HDD random read latency: ~8–12 ms
A page fault on an SSD is a barely-noticeable hiccup. A page fault on an HDD is a freeze you can feel. Even a small number of page faults per second on an HDD compounds into terrible stuttering.
If your SSD is nearly full (above 90% capacity), consider either clearing space or enabling a secondary page file on your HDD as overflow — but keep the primary on the SSD.
Moving the Page File to a Different Drive
sysdm.cpl → Advanced → Performance → Settings → Advanced → Change
- Uncheck Automatically manage paging file size for all drives.
- Select your C: (SSD) drive.
- Click No paging file → Set. (Temporarily; you will re-add it.)
- Select your target D: (fast SSD) drive.
- Enter your initial and maximum sizes.
- Click Set → OK.
- Restart.
Or via PowerShell/WMI:
# Disable automatic management first
$cs = Get-WmiObject -Class Win32_ComputerSystem
$cs.AutomaticManagedPagefile = $false
$cs.Put()
# Remove existing page file settings
$existing = Get-WmiObject -Class Win32_PageFileSetting
foreach ($pf in $existing) { $pf.Delete() }
# Create new page file on D: drive
$pf = ([wmiclass]"Win32_PageFileSetting").CreateInstance()
$pf.Name = "D:\pagefile.sys"
$pf.InitialSize = 4096
$pf.MaximumSize = 4096
$pf.Put()
Write-Host "Page file moved to D:. Restart required."
Performance vs. Stability Tradeoffs
| Configuration | Performance | Stability |
|---|---|---|
| No page file | Highest (no disk I/O for VM) | Poor (crash risk, app failures) |
| System-managed | Moderate (unpredictable sizing) | Good |
| Fixed size on SSD | High (no resize I/O, fast access) | Best |
| Fixed size on HDD | Poor (HDD seek times) | Good |
Tuning the Page File for Gaming Sessions
Some power users go further — they temporarily increase the page file before a known memory-heavy session and reduce it after:
# Function to adjust page file size
function Set-PageFile {
param([int]$InitMB, [int]$MaxMB, [string]$Drive = "C:")
$pf = Get-WmiObject -Query "SELECT * FROM Win32_PageFileSetting WHERE Name LIKE '${Drive}%'"
$pf.InitialSize = $InitMB
$pf.MaximumSize = $MaxMB
$pf.Put()
Write-Host "Page file set: ${InitMB}MB / ${MaxMB}MB on $Drive. Restart to apply."
}
# Before a flight sim session with 16 GB RAM
Set-PageFile -InitMB 8192 -MaxMB 16384 -Drive "C:"
Note: Page file size changes require a restart to take effect. This approach is useful only if you plan your sessions and restart between them.
Checking Page File Usage After Gaming
Run this after a long session to see peak usage:
Get-WmiObject -Class Win32_PageFileUsage | Select-Object Name, CurrentUsage, PeakUsage, AllocatedBaseSize | Format-Table -AutoSize
If PeakUsage is near zero consistently across multiple sessions, your RAM is sufficient and the page file is acting only as a safety net — which is exactly where you want to be with 32 GB+ of RAM.
Summary
The optimal page file setup for a gaming PC is a fixed-size file on your fastest SSD, sized to hold at least a full memory dump (equal to your installed RAM), with initial = maximum to prevent fragmentation. Disabling it entirely introduces instability risk with no meaningful performance benefit if the page file was never being paged to in the first place. Check your PeakUsage value — if it stays below 512 MB, set 2 GB fixed and move on to optimizations that will actually move your benchmark numbers.