# 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](https://learn.microsoft.com/en-us/windows/win32/power/system-power-states) 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](https://learn.microsoft.com/en-us/troubleshoot/windows-client/setup-upgrade-and-drivers/disable-and-re-enable-hibernation) 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:

```cmd
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](https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/powercfg-command-line-options) says to run `powercfg /h /size 0` first so Windows manages the size again, then change the type. To get full hibernation back later:

```cmd
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](https://learn.microsoft.com/en-us/troubleshoot/windows-client/performance/how-to-determine-the-appropriate-page-file-size-for-64-bit-versions-of-windows) 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, up to three times RAM or 4 GB, whichever is larger, and no more than an eighth of the volume. A very large `pagefile.sys` on C: usually means demand was high at some point and the file grew to meet it.

## Moving the page file to another drive

If the PC has a second internal drive, you can put the page file there:

1. Press `Win + R`, type `sysdm.cpl` and open System Properties.
2. On the Advanced tab, click Settings under Performance, open the Advanced tab again and click Change under Virtual memory.
3. Clear "Automatically manage paging file size for all drives".
4. Select D:, choose "System managed size" and click Set.
5. Select C:, choose "No paging file" or a smaller custom size as needed, click Set, then confirm and restart when prompted.

Before leaving C: with no page file at all, decide how crash dumps will be stored: make sure the page file on the other drive is large enough, or set up a dedicated dump file as Microsoft describes. Otherwise the next blue screen may leave no dump, and that is the most useful evidence when investigating it. 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 | Move to another internal drive | Do not set every drive to no paging file |

<figure class="blog-diagram">
  <picture>
    <source media="(max-width: 900px)" srcset="/img/blog/windows-hiberfil-pagefile-c-drive-windows-en-mobile.webp" type="image/webp" width="768" height="1180">
    <img src="/img/blog/windows-hiberfil-pagefile-c-drive-windows-en.webp" width="1360" height="454" loading="lazy" alt="What the two hibernation file types and the page file are for">
  </picture>
  <figcaption>A full hibernation file supports hibernate and Fast Startup, a reduced one keeps only Fast Startup, and the page file handles both paging and crash dumps.</figcaption>
</figure>

## Checking the result

Restart once and look at the root of C: again. `hiberfil.sys` should be smaller, and a moved `pagefile.sys` should no longer be there. Storage in Settings shows how free space changed. 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](/windows/blog/find-large-files-on-windows) and [High memory usage on Windows](/windows/blog/windows-high-memory-usage).


Canonical: https://mole.fit/windows/blog/hiberfil-pagefile-c-drive-windows
