Hiberfil.sys, Pagefile.sys, and Swapfile.sys in Windows: Differences and Management

Last update: 26/05/2025
Author Isaac
  • hiberfil.sys, pagefile.sys, and swapfile.sys play key roles in memory and suspension management in Windows.
  • Deleting or shrinking these files frees up space but may affect system stability or functionality.
  • Managing its size is possible and advisable depending on RAM usage and the characteristics of the computer.

Differences between hiberfil.sys, pagefile.sys and swapfile.sys on Windows

When you explore the contents of your hard drive in Windows, sooner or later you'll come across mysterious files called hiberfil.sys, pagefile.sys, and swapfile.sys. These files are usually hidden and protected by the operating system itself, but they're noticeable because they can take up many gigabytes of space. Do you really know what they're for, whether you can delete them, or how they affect your computer's performance?

In this article, we'll delve into the differences, functions, and how to manage these files in Windows. We'll also analyze whether it's worthwhile to delete them, reduce their size, or simply let the system handle them. All of this will be explained in a straightforward manner, without unnecessary technical jargon, and with practical tips to help you get the most out of your computer's storage .

What are hiberfil.sys, pagefile.sys and swapfile.sys?

To understand why these files exist and what their role is in Windows, you need to know how the system manages RAM and the methods of suspension and hibernation.

Hiberfil.sys is the file Windows uses to save the entire contents of RAM when the computer enters hibernation mode or uses certain features like fast startup . Essentially, it makes an exact copy of what's in RAM, allowing everything to return to its previous state upon restarting.

Pagefile.sys is known as the paging file or virtual memory . It allows the system to use part of the disk storage as if it were additional RAM when the physical memory is full. This way, Windows moves less frequently used processes and data to the disk, reserving RAM for higher-priority tasks.

Swapfile.sys , meanwhile, appeared in Windows 8 and later versions. Its function is very similar to that of pagefile.sys, but it focuses on managing memory for modern Universal Windows Platform (UWP) apps and for the quick suspension and resume of Metro apps . This file allows these applications to run in the background without consuming all of the physical RAM.

Location of hiberfil.sys, pagefile.sys and swapfile.sys files

Where are these files located and why are they not easily visible?

By default, all these files are created and stored in the root directory of the drive where Windows is installed, usually C:. However, Windows keeps them hidden and protects them from accidental access or unauthorized deletion. To view them, you need to go to Folder Options and uncheck the box labeled "Hide protected operating system files."

  How to delete a game from the Nintendo Switch OLED console Delete games

If you prefer to use the command line , you can view them by running the command DIR /A:HC:\ in the console. They will appear there alongside other system files.

What exactly is hiberfil.sys and how does it work?

Hiberfil.sys is essential for hibernation mode, a classic feature of laptops and desktop computers that allows you to shut down your PC while saving the exact state of the system . When you hibernate your computer, Windows copies all the contents of RAM to hiberfil.sys. Then, the machine shuts down completely, consuming zero power. When you turn it back on, the system simply restores that file to RAM, picking up where you left off.

Furthermore, since Windows 8, this file has also been used to implement "fast startup," which speeds up booting by saving part of the system kernel and core drivers. Therefore, even if you don't manually use hibernation, hiberfil.sys may still be present on your hard drive.

The size of hiberfil.sys is typically similar to the installed RAM, although it can be adjusted using advanced commands (for example, using powercfg.exe /hibernate /size 50 to reduce it to 50%). However, it cannot be smaller than half of the physical RAM.

What does pagefile.sys do and why is it important?

Pagefile.sys is the well-known virtual memory or paging file . Its purpose is to allow Windows to manage workloads that exceed the amount of installed RAM. When physical memory becomes full, Windows "pages" or moves infrequently used data to pagefile.sys, freeing up space in real RAM for more important tasks.

This file is essential to prevent crashes and forced program shutdowns when RAM is low. It helps the operating system and demanding applications run smoothly, even when RAM is at its limit.

The size of pagefile.sys depends on RAM and Windows' automatic or manual settings . By default, the system adjusts its size dynamically, but the user can change it, limit it, or even disable virtual memory completely (although the latter is only recommended if you have plenty of RAM and know what you're doing).

  How to disable telemetry and tracking in Windows 11 with ShutUp10++

What role does swapfile.sys play?

Swapfile.sys is the least known of the three files , but it serves a very specific purpose in modern versions of Windows. It's designed for the efficient management of the suspension and quick resume of Universal Windows Platform (UWP) apps, especially those that come pre-installed on the system and those developed for the Metro/ModernUI interface.

This file allows these apps to remain "paused" without taking up physical memory, and speeds up their reopening. Its size is much smaller than pagefile.sys or hiberfil.sys, and it's not usually a problem in terms of disk space.

Can you really delete these files without anything happening?

This is the million-dollar question. The answer varies depending on the file and how you use your computer.

Delete hiberfil.sys: If you never use the hibernation feature (and don't rely on fast startup), you can delete hiberfil.sys with no major consequence other than losing that capability. To do this, you must disable hibernation using the command ` powercfg /h off` in a terminal window with administrator privileges. Upon restarting, Windows will delete hiberfil.sys and free up several gigabytes of RAM, depending on your system's capacity.

The only negative effect is that you won't be able to hibernate the computer, and Fast Startup mode will no longer be available, so booting will be slightly slower. Except for laptops where hibernation is useful to save battery life, disabling it isn't usually a problem.

Remove or reduce pagefile.sys

  • Go to Control Panel > System > Advanced system settings.
  • On the “Advanced” tab, click “Settings” under Performance.
  • Select the Advanced tab again and click Change under Virtual Memory.
  • Uncheck the “Automatically manage paging file size for all drives” box.
  • Select “No paging file” and press Set to remove it, or select “Custom size” to limit its space (for example, 4000 MB initial and 8000 MB maximum, depending on your needs and RAM).
  • Click OK and restart your computer to apply the changes.

Tip: If you have more than one disk, you can move the page file to a secondary drive, provided it's as fast as or faster than your primary drive. Moving it to a slower drive may actually worsen performance instead of improving it.

  Tips on how to Repair Can't Authorize Laptop On iTunes Error

Reduce the size of hiberfil.sys (optional)

  • Open the command prompt as administrator.
  • Write powercfg.exe /hibernate /size 50 so that it uses only half of your RAM (less than 50% is not possible).

How much space do these files actually take up?

The size of each file depends on the amount of RAM and system configuration:

  • Hiberfil.sys: It typically takes up between 75% and 100% of your RAM. For example, if you have 16 GB of RAM, the file could take up between 12 and 16 GB.
  • Pagefile.sys: Its size is dynamic, but is typically between 1 and 1,5 times the RAM, although it can be much smaller if you limit it manually.
  • Swapfile.sys: It is the smallest, usually less than 1 GB, depending on the UWP apps in use.

These files can take up tens of gigabytes, which is especially important on laptops with limited-capacity SSD drives.

Advantages and disadvantages of deleting or modifying these files

Advantages of eliminating or reducing them:

  • Free up a significant amount of space (several gigabytes) if you have little storage.
  • Better control over the resources used by the system.

Disadvantages or possible risks:

  • You will lose the ability to hibernate (in the case of hiberfil.sys) or use fast startup.
  • If you delete pagefile.sys on a computer with limited RAM, you may experience crashes, unexpected shutdowns, or decreased performance.
  • Some programs may require virtual memory to function properly.

What happens if you delete both files?

If you remove both hiberfil.sys and pagefile.sys, and you also have limited RAM, your computer may become unstable or even crash when opening multiple applications simultaneously. On modern computers with 16 GB or more of RAM, this is usually not a problem , but on older PCs or those with limited memory, it's best to at least keep the page file.

As for swapfile.sys, it's not worth worrying about its space unless you're looking for maximum optimization and know exactly what you're doing.

Related articles:
Windows 10 FIX: Large Windows.edb Files