How to Optimize Virtual Memory and Pagefile on Windows
Performance
5 min readOctober 13, 2026

How to Optimize Virtual Memory and Pagefile on Windows

Windows virtual memory and pagefile settings directly affect how your PC handles heavy workloads. Learn how to tune them for better performance and fewer slowdowns.

Share

How to Optimize Virtual Memory and Pagefile on Windows

When your PC runs low on physical RAM, Windows turns to virtual memory — a reserved section of your hard drive or SSD that acts as overflow storage for active processes. The file that manages this space is called the pagefile (pagefile.sys), and its size and location can have a measurable impact on system performance. Misconfigured pagefile settings are a common but overlooked cause of slowdowns, stuttering, and even crashes.

This guide walks you through understanding virtual memory, diagnosing pagefile-related issues, and tuning the settings for your specific hardware.


Free AI Diagnosis

Having this problem on your own PC?

Describe what's happening and get a real AI diagnosis in seconds — no account needed.

What Is Virtual Memory and Why Does It Matter?

Virtual memory extends your usable RAM by using disk space as a temporary buffer. When Windows needs more memory than your physical RAM can provide, it moves less-active data from RAM into the pagefile, freeing up RAM for the tasks that need it most.

Too small a pagefile: Windows may crash or throw "out of memory" errors under heavy load

Too large a pagefile on a slow HDD: Excessive paging causes noticeable stuttering

Pagefile on a fast NVMe SSD: Paging overhead is minimal and rarely noticeable

System-managed pagefile: Windows adjusts size dynamically, which works well for most users but can fragment the file over time

The key insight: if you have 16 GB or more of RAM and an NVMe SSD, pagefile tuning matters less. If you have 8 GB or less of RAM, or a spinning hard drive, getting this right can meaningfully improve day-to-day responsiveness.


Step 1: Check Your Current Pagefile Configuration

Before changing anything, see what Windows is currently doing.

1

Press Win + R, type sysdm.cpl, and press Enter

2

Go to the Advanced tab → click Settings under Performance

3

In the Performance Options window, click the Advanced tab

4

Under Virtual Memory, click Change

You'll see the current pagefile size and which drive it lives on. Note whether Automatically manage paging file size for all drives is checked.

Alternatively, check via PowerShell:

Get-WmiObject -Class Win32_PageFileUsage | Select-Object Name, AllocatedBaseSize, CurrentUsage, PeakUsage

This shows the pagefile path, its allocated size in MB, and how much has been used at peak — useful for deciding whether your current size is adequate.


Step 2: Identify Whether Paging Is Causing Slowdowns

High pagefile usage is a symptom, not a root cause. The root cause is usually insufficient RAM for your workload. Before tuning the pagefile, confirm paging is actually happening:

Using Resource Monitor

1

Press Win + R, type resmon, press Enter

2

Go to the Memory tab

3

Watch the Hard Faults/sec counter — this measures how often Windows has to read data from the pagefile instead of RAM

A sustained Hard Faults/sec above 10–20 during normal use indicates active paging. If this number is near zero, your pagefile size is not the bottleneck.

Using Performance Monitor

perfmon /rel

Look for Memory warnings in the Reliability Monitor timeline. Repeated memory-related events often correlate with pagefile pressure.


Step 3: Choose the Right Pagefile Strategy

There is no single correct pagefile size — it depends on your RAM, storage type, and workload.

Recommended Sizes by RAM

4 GB RAM: Set pagefile to 4,096–8,192 MB (minimum and maximum the same to prevent fragmentation)

8 GB RAM: Set pagefile to 2,048–4,096 MB

16 GB RAM: System-managed is usually fine; or set a fixed 1,024–2,048 MB

32 GB+ RAM: A small fixed pagefile of 512–1,024 MB is sufficient; some apps require a pagefile to exist even if rarely used

Setting minimum and maximum to the same value prevents Windows from dynamically resizing the file, which reduces fragmentation and keeps performance consistent.

Pagefile Location

NVMe SSD: Best location — fast enough that paging is nearly transparent

SATA SSD: Good — still fast, minimal impact

HDD: Avoid if possible; if unavoidable, place the pagefile on the fastest partition

If you have multiple drives, placing the pagefile on a secondary SSD (not your OS drive) can reduce I/O contention.


Step 4: Apply the New Pagefile Settings

1

In the Virtual Memory dialog (from Step 1), uncheck Automatically manage paging file size for all drives

2

Select your target drive

3

Choose Custom size

4

Enter your chosen Initial size and Maximum size (in MB)

5

Click Set, then OK

6

Restart your PC for the change to take effect

> Important: Do not set the pagefile to No paging file unless you have 32 GB+ of RAM and understand the risks. Some Windows components and crash dump features require a pagefile to function correctly.


Step 5: Verify the Change and Monitor Performance

After restarting, re-run the PowerShell command from Step 1 to confirm the new pagefile size is active. Then monitor Hard Faults/sec in Resource Monitor during your typical workload to see whether paging has decreased.

If you're still seeing high paging after tuning, the real fix is adding more RAM — the pagefile is a safety net, not a substitute for physical memory.


Let DiagnoseMyPc Do the Heavy Lifting

Not sure whether your pagefile settings are contributing to slowdowns? DiagnoseMyPc can help you pinpoint the issue without manual digging. Upload a screenshot of your Resource Monitor, paste the output of a PowerShell memory command, or run the optional Windows scan tool to collect system data automatically — then describe what you're experiencing and get a guided analysis.

The free plan includes 5 analyses per month, which is plenty for diagnosing a specific performance problem like pagefile pressure or RAM exhaustion.

Visit DiagnoseMyPc to run your first analysis and find out exactly what's slowing your PC down — no guesswork required.

Found this helpful?

Share it with someone who could use it.

Share

DiagnoseMyPC Team

Expert PC diagnostics and troubleshooting guides to help you keep your Windows system running smoothly.

Get the free Windows Troubleshooting Checklist

Subscribe and instantly download our 50-point Windows troubleshooting checklist — plus practical fixes, performance tips, and security alerts from the DiagnoseMyPC team.

No spam. Unsubscribe anytime.

Frequently Asked Questions

Why is my PC still slow after I cleaned it up?

Generic cleanup often misses the real bottleneck — a background process pinning your disk, a driver conflict, or low available RAM. An AI diagnosis reads your actual system data to pinpoint what's actually slowing you down instead of deleting files at random. Run a free scan at diagnosemypc.com.

Will adding more RAM speed up my computer?

It helps if you're regularly running out of memory (high RAM usage, lots of open tabs or apps). But if the bottleneck is a slow hard drive, a startup bloat problem, or a background process, more RAM won't fix it. Diagnose first, then upgrade.

How often should I check my PC's performance?

A quick monthly check is enough for most people, plus a scan any time you notice new slowdowns, crashes, or after a big Windows update. Catching issues early keeps small problems from turning into crashes or data loss.

Is a free performance scan actually useful?

Yes — a free AI scan gives you a real, prioritized list of what's wrong with your system. For one-click fix scripts and detailed step-by-step guides, there's an affordable $4.99 Fix Pass, but the diagnosis itself is free.

Free Diagnostic Tool

Having PC Issues? Let AI Diagnose Them

Get an AI-powered analysis of your Windows PC in under 5 minutes — no technical knowledge required, no account to get started.