How to free up space on your disk drive by compressing the Windows hibernation file

Our readers constantly ask us that Windows is taking up a lot of their disk space on the OS volume and that the free space is constantly reducing as they install updates and new apps. Previously, we covered some ways to get free disk space back by cleaning up the Windows Component Store on Windows 8.1/Windows 8 and Windows 7. We also showed how you can automate Disk Cleanup and run it directly in the system files mode. Today we would like to show you how you can free up disk space by enabling compression on your Windows hibernation file.

When hibernation is enabled in Windows, the OS creates a file called hiberfil.sys in the root of your C: Drive. This hiberfil.sys stores the contents of memory (RAM) when you hibernate your PC. When you resume from hibernation, Windows 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, features like Fast Startup in modern versions of Windows such as Windows 8/8.1 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.

  1. Open an 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.
    hiberfile 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.

    The size you specify cannot be smaller than 50, although if you hack around in the Registry, you can get a smaller size (highly not recommended).
    hiberfil
    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.

If you have hibernation turned off, the powercfg hibernate size switch will automatically enable hibernation.

You can see the size of the C:\hiberfile.sys file in Explorer in gigabytes (GB) by selecting it or opening its Properties. Normally, this system file is hidden so you may need to turn on the setting to show hidden files as mentioned in step 2 of this article.

Note that depending on the quality of your RAM, your PC may fail to resume successfully if you set the hibernation file size too low such as 50%. In that case, if it fails to resume, set it to a slightly higher size such as 60% or 65%.

One thought on “How to free up space on your disk drive by compressing the Windows hibernation file

  1. Harry Ward

    This was a great tip, and I have implemented for my Win 7 Pro laptop.

    But on my Win 7 Pro desktop, I do not use the hibernate state. My power is always on, although I do use a screen saver, and turn off the display after about 30 minutes of inactivity. Therefore, can I just delete hiberfil.sys? If so, do I do anything more sophisticated than just delete it from Windows Explorer?

    Thanks. And thanks for all your great tips here and in Classic Shell.

    Harry

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply

Leave a Reply

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