Can You Shrink hiberfil.sys and pagefile.sys on Windows?
Show hidden files in File Explorer and clear "Hide protected operating system files", and two large files appear at the root of C:, hiberfil.sys and pagefile.sys. Both tend to grow with installed memory: at the default ratio, the hibernation file alone is about 12.8 GB on a PC with 32 GB of RAM. Windows is using both, so you cannot delete them from the context menu. The common advice is to turn hibernation off or set virtual memory to "No paging file". That does recover space, but it is worth knowing what you give up first.
What hiberfil.sys holds
hiberfil.sys is the hibernation file. When you hibernate, Windows writes the contents of memory into it and powers off, then reads it back at the next start so your open apps are where you left them. It is often present on PCs that never hibernate, because Fast Startup depends on it: with Fast Startup on, shutting down signs out your session and saves the kernel state to this file, and the next cold start resumes from it instead of starting from scratch.
Microsoft's system power states documentation describes two hibernation file types. A full file defaults to about 40% of physical memory and supports hibernate, hybrid sleep and Fast Startup. A reduced file is about 20% of memory and supports Fast Startup only.
Turning hibernation off versus switching to reduced
Running powercfg /h off as administrator deletes hiberfil.sys and turns off hibernate, hybrid sleep and Fast Startup together. Microsoft's article also warns that without hybrid sleep, a power loss during sleep can lose unsaved work.
If you only want Fast Startup and never hibernate, switch the file type to reduced instead:
powercfg /h /type reduced
At 40% and 20% of memory, a 32 GB PC goes from roughly 12.8 GB to 6.4 GB, about 6 GB back. The cost is that Hibernate disappears from the power menu, and a laptop left closed off the charger no longer moves into hibernation to save its session. If you once set a custom size with /size, the powercfg reference says to run powercfg /h /size 0 first so Windows manages the size again, then change the type. If you only switched to reduced, restore the full type with the command below. If you turned hibernation off, first run powercfg /h on as administrator to enable it again:
powercfg /h /type full
Do not turn pagefile.sys off entirely
pagefile.sys is the paging file. When memory is under pressure, Windows writes infrequently used, modified pages to it, and it also backs the crash dump written when the system stops. Microsoft's page file guidance is direct about it: without a page file or a dedicated dump file, no crash dump is created. Without a page file, the commit limit, how much memory Windows can promise to programs, drops slightly below installed RAM, so a large allocation can still fail however much memory you have.
The default system-managed size grows and shrinks with installed memory, crash dump settings and actual use, normally up to three times RAM or 4 GB, whichever is larger, capped at an eighth of the volume. Crash-dump requirements can let it grow beyond that cap, leaving as little as 1 GB free. A large pagefile.sys can reflect memory demand, usage history or dump settings; size alone does not identify the cause.
Moving the page file to another drive
If the PC has a second internal drive, you can add a page file there. Keep the system-managed page file on C: unless you have configured and verified an alternative for the selected crash-dump type. A sufficiently large file on D: alone does not establish this: complete memory dumps have a boot-drive requirement, while a dedicated dump file needs its own configuration.
- Press
Win + R, typesysdm.cpland open System Properties. - On the Advanced tab, click Settings under Performance, open the Advanced tab again and click Change under Virtual memory.
- Clear "Automatically manage paging file size for all drives".
- Select D:, choose "System managed size" and click Set.
- Keep C: set to "System managed size" unless the alternative dump configuration has been verified, then confirm and restart when prompted.
Adding a page file on D: does not by itself free space on C:. If you need to reduce the C: file, first follow Microsoft’s dedicated-dump configuration guidance and verify the selected dump requirements. Otherwise the next blue screen may leave no dump for investigation. External or removable drives are not a good place for a page file.
| File | Purpose | To recover space | Keep in mind |
|---|---|---|---|
hiberfil.sys |
Hibernate, hybrid sleep and Fast Startup | powercfg /h /type reduced |
No hibernation after reducing |
pagefile.sys |
Paging and crash dumps | Consider another internal drive after verifying dump configuration | Keep C: system-managed until that is verified |
Checking the result
Restart once and check the files against the option you chose: reduced hibernation should use a smaller hiberfil.sys, while turning hibernation off removes it. If C: retains a page file, pagefile.sys remains there. Reopen Virtual memory to confirm each drive’s configuration, then check free space in Storage settings. Then use the PC normally for a few days: whether startup, closing the lid and your usual large apps still behave tells you more than the number you saw right away. To keep looking for large files, continue with Finding large files on Windows and High memory usage on Windows.