Compress Files on NTFS with LZX Algorithm in Windows 10

Zip Archive Icon

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.

  1. Open an elevated command prompt.
  2. 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)
  • XPRESS8K
  • XPRESS16K

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
is specified.

/s - Performs the specified operation on files in the given
directory and all subdirectories. Default "dir" is the
current directory.

/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
encountered.

To unpack the compressed files (restore defaults), use the following command:

compact /u /a /s /exe "C:\data\*"

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

4 thoughts on “Compress Files on NTFS with LZX Algorithm in Windows 10”

    1. https://github.com/ImminentFate/CompactGUI/releases
      But keep in mind that not all compressed rates are compatible lower than win10 (WinSRV2k16?)

  1. Possible to add to the tweak tool for right click (context menu) Compress/Decompress?

    Thanks for all the great work to help bandage the gaping wound that MSFT keeps opening up by taking away features/functions!

  2. Hi,
    LZX option compresses more than XPRESS16K, takes more time to compress, usage is ok.
    Sad to say, both LZX and XPRESS* do not compress as well as lz4 and are 3x-10x slower; try zstd too and you’ll notice how “old tech” is LZX.
    /P

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.