Can you delete hiberfil.sys? Turn off hibernation in Windows to free disk space

Translated from the original Traditional Chinese version.

Summary

hiberfil.sys is the Windows hibernation file. You cannot delete it directly. Run powercfg -h off as administrator to turn hibernation off and let Windows remove the file itself. Hibernate, Fast Startup, and hybrid sleep are disabled together, and powercfg -h on brings them back.

Table of contents

You see a hiberfil.sys of several GB in the root of drive C, and Windows blocks you when you try to delete it. You can get rid of the file, but the way to do it is to turn off hibernation. Run powercfg -h off as administrator, and Windows deletes the file itself.

hiberfil.sys is the hibernation file. When the computer hibernates, Windows writes the contents of memory to this file and shuts down, then restores from the file at the next startup. According to Microsoft’s system power states documentation, the hibernation file is about 40% of physical memory by default, so the more RAM you have, the more space it takes.

Check how much space hiberfil.sys uses

hiberfil.sys is a hidden system file, so File Explorer does not show it by default. You can scan drive C with a disk analyzer. The screenshot below uses TreeSize Free. On this PC, hiberfil.sys takes 12.7 GB, and drive C uses 380.5 GB in total.

The TreeSize Free window in this screenshot uses a Traditional Chinese interface. The red boxes mark the total usage of 380.5 GB at the top and the 12.7 GB hiberfil.sys in the root folder.

TreeSize Free scanning drive C, with boxes around the total usage of 380.5 GB and the 12.7 GB hiberfil.sys in the root folder

Turn off hibernation with powercfg

powercfg needs administrator rights. Click Start and search for cmd. Next to “Command Prompt”, choose “Run as administrator”.

This screenshot is from Traditional Chinese Windows. The numbered marks show, in order, the Start button, the search box, the Command Prompt result, and the “Run as administrator” action.

The Start menu searching for cmd, with marks on the Start button, the search box, Command Prompt, and Run as administrator
When the window title says “Administrator: Command Prompt”, type the following command and press Enter:

1powercfg -h off

When the command succeeds it prints nothing and returns straight to the prompt.

The title bar in this screenshot reads “Administrator: Command Prompt” in Traditional Chinese.

A window titled “Administrator: Command Prompt” running powercfg -h off with no output
Go back to TreeSize and click “Refresh” to scan again. hiberfil.sys is gone from the root folder, and drive C usage dropped from 380.5 GB to 367.8 GB.

TreeSize Free after clicking the boxed Refresh button, with no hiberfil.sys in the root folder list and total usage down to 367.8 GB

What turning off hibernation affects

powercfg -h off turns off the whole hibernation mechanism, so these features stop together:

  • Hibernate: the computer can no longer hibernate, and the “Hibernate” entry in the power menu disappears if you had added it.
  • Fast Startup: the default Fast Startup in Windows also relies on the hibernation file, so startup goes through the full boot process after you turn it off.
  • Hybrid sleep: not available. Microsoft warns that a computer that relied on hybrid sleep can lose unsaved data if it loses power during sleep.

Turn hibernation back on

To restore hibernation later, run this as administrator:

1powercfg -h on

Windows creates hiberfil.sys again, and Fast Startup comes back too.

Summary

You cannot delete hiberfil.sys directly. Turn hibernation off with powercfg -h off and Windows removes the file itself, which freed 12.7 GB on this PC. Hibernate, Fast Startup, and hybrid sleep are disabled together, and powercfg -h on restores them.

PreviousHow to use TreeSize Free to find what is filling your Windows driveWorkflowNextMinecraft Java Edition server setup: server.jar download, Java 25 and first startGames
Ted Liou

Ted Liou

Software engineer writing about Unity and AI development. Available for consulting.