Windows 11

This simple compact OS command can reclaim gigabytes of disk space

4 min read Editorial

A Windows user has recently drawn attention to a built-in command-line utility that many people overlook, and the payoff is substantial: the compact OS command can compress system files to free up several gigabytes of storage — without the performance penalty you might expect from compressing an entire operating system.

The tool in question is compact.exe, and the specific switch that does the heavy lifting is /compactOS. It isn’t new, but it’s easy to forget it exists, especially since Windows ships with it enabled on many fresh installs. Here’s what it does, how much space you can realistically expect, and whether you should turn it on.

What the compact OS command actually does

The compact utility is a command-line tool that works on NTFS volumes and can display or change the compression state of individual files and folders. When you point it at the whole operating system with the /compactOS flag, it takes a more thorough approach than compressing a single document.

Advertisement

Instead of compressing files one at a time, it rewrites the core Windows components — the system files, built-in apps, and much of the OS image — using a compressed file system. In practice, this means the data is stored in a compressed form on disk but decompressed on the fly whenever Windows needs to read it.

That on-the-fly decompression is the key detail. Modern CPUs include dedicated instructions for fast compression and decompression, so the overhead of unpacking system files in real time is small enough that most users won’t notice it during everyday tasks.

A close-up of a hard drive icon transforming into a compressed zip archive, isometric 3D render, blue and orange gradien
System files compressed on disk, freeing up space without deleting anything.

How much space can you actually reclaim?

The amount you save depends heavily on how your installation is set up, what apps you’ve added, and which version of Windows you’re running. In typical real-world cases, enabling OS-level compression frees up somewhere in the range of a few gigabytes — commonly reported figures land around 2GB to 4GB on a standard install.

That figure matters most on machines with a small solid-state drive. If you’re working with a 256GB SSD, reclaiming a few gigabytes of system space is a meaningful chunk. On a 1TB drive, it’s still free space you didn’t have before, but it won’t change how you manage storage day to day.

You can check the current state of compression on your system without changing anything. Running the query form of the command tells you whether OS compression is already active and, in many cases, roughly how much space it has already recovered.

Is there really no performance hit?

The “no performance hit” claim is where people tend to be skeptical, and for good reason. Compressing and decompressing data always costs some CPU cycles, and older or lower-end hardware has less headroom to absorb that cost.

That said, the reality for most users on relatively modern hardware is that the difference is negligible. Browsing the web, editing documents, and watching video don’t stress the decompression path enough for the overhead to show up in anything measurable. Gaming and heavy CPU-bound workloads are where you’d be most likely to notice a change, if at all.

The trade-off is essentially storage space versus a tiny slice of CPU time. On a machine with a limited drive and a reasonably modern processor, that’s usually a good exchange.

How to enable the compact OS command

Because this modifies system files, you need to run the command from an elevated prompt. Open the Start menu, search for Command Prompt, right-click it, and choose Run as administrator.

First, take a look at your current status by typing the query command and pressing Enter. This confirms whether OS compression is already on before you change anything.

To turn it on, enter the command that enables OS-level compression and press Enter. Windows will then compress the relevant files, which can take a few minutes, and you’ll get a summary of how much space was recovered when it finishes.

If you later decide you’d rather have the space back in CPU terms than on your drive, you can disable it with the matching command, which restores the uncompressed system files.

What this means for you

The practical takeaway is simple: if you’re tight on disk space and your hardware isn’t ancient, this is a zero-cost way to reclaim gigabytes without installing any third-party tool or touching your files. It operates on the operating system itself, so there’s nothing to configure beyond a single command.

It’s also reversible and non-destructive — it doesn’t delete or alter your personal data, just the way Windows stores its own files. That makes it a low-risk thing to try, and just as easy to turn back off if you don’t like the result.

For most everyday users, the balance tips clearly in favor of enabling it on a small drive. The space you gain is real, the process is built into Windows, and the performance cost is, for nearly everyone, invisible.

Source: Neowin

Over to you: Do you already have OS compression enabled, or would this command change how you manage the space on your drive?

Advertisement
Share:
Editorial
Written by
Editorial

Windows & Microsoft news editor at 9to5Windows. Covering everything from Windows 11 builds to enterprise updates.

Advertisement