As you may already know, it is possible to enable NTFS compression for files and folders in Windows 10. Unlike ZIP file compression, with this compression type, you do not need to create an archive file. Compression will happen on-the-fly and the files can be accessed transparently as they were before compressing. Windows 10 supports NTFS compression natively like previous versions of the OS, but it supports a number of newer algorithms including LZX, which was not available prior to Windows 10.
NTFS compression makes certain files and folders smaller. Certain files like images, videos, music which are already compressed won't be shrunk but for other file types, it can save you disk space. But keep in mind that it affects performance. This is because of extra operations the OS has to perform when the file is accessed, copied out of a compressed folder or put inside a new compressed folder. During these operations, Windows has to decompress the file in memory. As is evident from the name of the feature, NTFS compression doesn't work when you copy your compressed files over the network, so the OS has to decompress them first and transfer them uncompressed.
When a file or folder is compressed, Windows 10 displays a special double blue arrow overlay over their icon. See the following example.
Tip: If you are not happy to see this overlay icon, see how to Disable blue arrows icon on folders and files in Windows 10.
Starting with Windows 10, you can use LZX compression. This is the strongest algorithm available for NTFS. Its compression ratio is about 50% for certain files, which is much more than the default NTFS compression.
Before you proceed, you need to know that files compressed with LZX in Windows 10 cannot be opened in Windows 7, Windows 8.1 or in any previous Windows version.
To compress files on NTFS using the LZX algorithm in Windows 10, do the following.
- Open an elevated command prompt.
- Type or paste the following command:
compact /c /s /a /i /exe:lzx "C:\data\*"
Substitute the C:\data portion with the actual folder path you want to compress.
This will apply LZX compression optimized for executable files which are read frequently and not modified.
Others algorithms are:
- XPRESS4K (fastest) (default)
It will compress other files as well.
The switches are as follows:
/c - Compresses the specified files. Directories will be marked
so that files added afterward will be compressed unless /EXE
/s - Performs the specified operation on files in the given
directory and all subdirectories. Default "dir" is the
/a - Displays files with hidden or system attributes. These
files are omitted by default.
/i - Continues performing the specified operation even after errors
have occurred. By default, COMPACT stops when an error has
To unpack the compressed files (restore defaults), use the following command:
compact /u /a /s /exe "C:\data\*"