- 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.
When you explore the contents of your hard drive in Windows, sooner or later you 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 attract attention because they can take up many gigabytes of space. Do you really know what they're for, if you can delete them, or how they affect your computer's performance?
In this article, we'll take an in-depth look at the differences, functions, and how to manage these files in Windows. We'll also analyze whether it's worth eliminating them, reducing their size, or simply letting the system handle them. All of this is explained in a natural way, without unnecessary technical jargon and with practical advice to get the most out of the system. storage from your computer
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 sleep and hibernation methods.
Hiberfil.sys It is the file that Windows uses to save the entire contents of RAM when the computer goes into hibernation mode or uses certain functions such as quick start. Basically, it makes an exact copy of what's in RAM, allowing everything to return to the way it was upon reboot.
Pagefile.sys It is known as the paging file or virtual memory. It allows the system to use part of the disk storage as additional RAM when the actual physical memory is full. This allows Windows to move less-used processes and data to the disk, reserving RAM for higher-priority tasks.
Swapfile.sys, on the other hand, appeared in Windows 8 and later versions. Its function is very similar to that of pagefile.sys, but it is focused on managing memory for modern universal applications (UWP) and for the rapid suspension and resuming of applications. apps Metro. This file allows these apps to run in the background without using up all of your physical RAM.
Where are these files located and why are they not easily visible?
Default, All these files are created and stored in the root of the drive where Windows is installed, usually C: However, Windows keeps them hidden and protects them from accidental access or unauthorized deletion. To see them, go to the folder options and uncheck the "Hide protected operating system files" box.
If you prefer to use the line of commands, you can see 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 function of the portable and desktop computers that allows you to shut down the PC while saving the exact state of the systemWhen you hibernate your computer, Windows copies the entire contents of RAM to hiberfil.sys. The machine then shuts down completely, consuming zero power. When you turn it back on, the system simply restores that file to RAM, resuming work where you left off.
In addition, since Windows 8 this file is also used to implement the so-called “fast startup”, which speeds up the Boot storing part of the system kernel and main drivers. Therefore, even if you don't manually hibernate, hiberfil.sys may be present on your disk.
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 famous virtual memory or paging fileIts purpose is to allow Windows to handle workloads that exceed the amount of installed RAM. When physical memory becomes full, Windows "pages out," or moves unused data to the 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 the RAM and the automatic or manual configuration of Windows.By default, the system adjusts its size dynamically, but the user can change it, limit it, or even disable virtual memory altogether (although the latter is only recommended if you have plenty of RAM and know what you're doing).
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 to efficiently manage the quick suspend and resume of Universal Apps (UWP), especially those built into the system and those developed for the Metro/Modern UI 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 hibernation (and don't rely on fast startup), you can delete hiberfil.sys without any consequences other than losing that capability. To do this, disable hibernation using the command powercfg /h off in a window of terminal with administrator permissions. Upon restart, Windows will delete hiberfil.sys and free up several gigabytes, depending on your RAM.
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 paging file to a secondary drive, as long as it's as fast as or faster than the primary drive. If you move it to a slower drive, performance may worsen rather than improve.
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 hard drives. SSD of limited capacity.
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 delete both hiberfil.sys and pagefile.sys and you also have low RAM, your computer may become unstable or even crash when you open multiple applications at once. On modern computers with 16GB or more of RAM there is usually no problem., but on older or low-memory PCs, it's better to keep at least the paging 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.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.