How Does Windows 10 CompactOS Compression Work?
CompactOS is an execution-level compression mechanism introduced in Windows 10 that shrinks operating system binaries to reclaim several gigabytes of internal storage. By leveraging modern file-system algorithms directly inside the NTFS file system, it decompresses system files transparently on the fly during boot and normal execution without requiring a separate recovery image.
Understanding CompactOS
CompactOS evolved from the Windows 8.1 feature known as WIMBoot
(Windows Image Boot). WIMBoot allowed devices with constrained storage,
such as budget tablets and netbooks with 16 GB or 32 GB eMMC drives, to
run Windows from a compressed .wim file. However, WIMBoot
required a separate disk partition and introduced update fragmentation
when OS patches were applied.
Windows 10 replaced WIMBoot with CompactOS, removing the need for
dedicated partitions. CompactOS applies file-level compression directly
to the standard OS directory hierarchy (C:\Windows,
C:\Program Files, and system dependencies). Because the
files reside within standard directories, servicing updates and
installing cumulative patches occurs directly in place without breaking
the compression architecture.
Underlying Compression Mechanisms
CompactOS utilizes native NTFS compression enhancements introduced alongside Windows 10. While legacy NTFS compression relies on LZNT1 (a variant of LZ77), CompactOS uses significantly more efficient algorithms:
- XPRESS4K / XPRESS8K: Fast, lightweight algorithms optimized for low CPU overhead.
- XPRESS16K: A middle ground offering stronger compression with moderate processor demand.
- LZX: A high-ratio compression algorithm that achieves the smallest disk footprint at the expense of higher CPU usage during initial compression and decompression.
Files compressed via CompactOS receive the
FILE_ATTRIBUTE_SPARSE_FILE or a designated reparse point
indicating that the data clusters are compressed using Windows Overlay
Filter (WOF). When an application or kernel process requests a file,
Wof.sys intercepts the I/O read, decompresses the required
blocks in memory, and passes the raw data to the caller without
persistent disk writes.
Performance and Hardware Impact
Decompressing data during runtime introduces a trade-off between processor overhead and disk read times:
- I/O Bound Systems: On mechanical hard drives or slow eMMC flash memory, CompactOS can actually improve responsiveness. Reading fewer bytes from slow storage media often offsets the minor processing time required to decompress data in RAM.
- Fast NVMe Storage: On modern solid-state drives with high read throughput, decompression can introduce a negligible CPU latency penalty, though modern multi-core processors process the decompression algorithms in microseconds.
- Write Operations: System updates modify files in place. If an updated file must remain compressed, the operating system recompresses the newly written blocks automatically during background maintenance routines.
Checking and Managing CompactOS via Command Line
Administrators can evaluate or alter the system compression state
using the built-in compact.exe utility inside an elevated
Command Prompt.
To query the current state:
compact.exe /compactos:queryThe system will report whether the OS is currently running in compact state and whether Windows considers the state beneficial for the machine's hardware configuration.
To force system compression:
compact.exe /compactos:alwaysTo uncompress the operating system and revert to standard storage:
compact.exe /compactos:neverDuring Windows setup, the installer automatically assesses system capabilities, evaluating storage size, RAM capacity, and drive performance. If storage constraints are detected, Windows enables CompactOS automatically to ensure sufficient free space remains for user profiles, operational paging, and future updates.