Compress Hibernation File in Windows 10

When hibernation is enabled in Windows 10, the OS creates a file called hiberfil.sys in the root of your C: drive. I would like to share how you can free up disk space by enabling compression on the hibernation file in Windows 10.

Compress Hibernation File in Windows 10

In this article:

  1. What is the hibernation file in Windows 10
  2. How to compress the hibernation file in Windows 10
  3. How to undo the hibernation file compression in Windows 10

What is the hibernation file in Windows 10

The hiberfil.sys stores the contents of memory (RAM) when you hibernate your PC. When you resume from hibernation, Windows 10 reads this file again and transfers its contents back to memory. Because memory capacities on modern PCs are always increasing, the hibernation file takes up considerable disk space.

Although you can disable hibernation and use sleep state or always keep your PC powered, it's not an energy-efficient way for mobile PCs. Also, some features like Fast Startup in Windows 10 depend on hibernation being enabled to boot the OS faster. If you disable hibernation, you lose the benefits of fast boot.

To solve the problem of increasing RAM capacities, Microsoft added the ability to compress the hibernation file in Windows 7. This means that the C:\hiberfil.sys file does not take as much disk space as your RAM capacity. It can take significantly less disk space, even 50% of your installed RAM capacity. This is a fantastic improvement Microsoft has made in Windows 7 and later, but it's turned off by default. Let's see how to turn it on.

How to compress the hibernation file in Windows 10

  1. Open an elevated command prompt. open-elevated-command-prompt
  2. Type the following command:
    powercfg hibernate size NN

    where NN is the desired hiberfile.sys size in percentage of the total memory.
    compress-hibernation-file-in-windows-10 For example, if you have 8 GB of RAM installed and you want to set the hibernation file size to 60% to save disk space. Then simply use this command:

    powercfg hibernate size 60

    This will set the hibernation file to 60% of 8 GB of RAM, meaning only 4.8 GB. It will save you 3.2 GB of disk space.

Even if you have only 4 GB or 3 GB of RAM, setting this to 50% will save you 2 GB or 1.5 GB of disk space respectively. So this is a very cool optimization you can always make on every Windows system. You will have more free space on your C: drive than before.

How to undo the hibernation file compression in Windows 10

 

  1. Open an elevated command prompt. open-elevated-command-prompt
  2. Type the following command:
    powercfg hibernate size 100

    decompress-hibernation-file-in-windows-10

This will disable the hibernation file compression in Windows 10. That's it.

The same can be done in Windows 8.1 and Windows 8.

 

7 thoughts on “Compress Hibernation File in Windows 10

  1. Toshik

    Fast startup kills SSDs, as it writes back the whole RAM size on SSD every time.
    As RAM size of 8-16GB is not uncommon now, it can result to drastic wear.

    With fast startup settings disabled, boot speed with fast drive is practically the same.

    Reply
    1. Sergey Tkachenko Post author

      Not sure if it kills SSDs, but in case of my PC, with FS disabled on SSD, I didn’t notice any slowdown.

      Reply
      1. Toshik

        On business laptop, while working in different places, hybernating 3-5 times a day, on stock settings Windows writes (with 8GB RAM conf) 24-40GB only by hyberation or shutdown (with fast startup enabled).
        Add to this Firefox or Chrome constantly writing session files to disk and other apps and it will result in up to 70GB of written on disk a day, which is a max daily write volume covered by warranty on my consumer Samsung SSD.

        So, i have also disabled this option and don’t feel any slowdowns on boot.

        Reply
    2. Bob

      Who’s forcing you to shut down your SSD PC every time? Just send it to sleep and shutdown/hibernate only when traveling long-distance where no power is available for a long time. Unlike HDD, the SSD won’t die even if on forever in sleep mode since it doesn’t spin.

      Reply
      1. Toshik

        That’s reasonable.

        Reply
  2. Bruno

    powercfg /h /type reduced have the same effect?

    Reply
    1. Sergey Tkachenko Post author

      Yep, with /type Reduced it will use hiberfil.sys only for Fast Startup, which is usually not more than 20% of ram.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.