How to Compress Files and Folders in Windows 10

In this article, we will see how 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 Windows.


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 it follows 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 arrows overlay over their icon. See the following example.

Windows 10 Compress File 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.

If saving disk space is your priority goal, here is how to enable NTFS compression in Windows 10.

To compress files and folders in Windows 10, do the following.

  1. Right click the file or folder you want to compress and select "Properties".Right Click Folder Properties
  2. On the General tab in Properties, click the button Advanced.General Tab Advanced Button
  3. In the next window, tick the check box Compress contents to save disk space under the Compress or Encrypt attributes section.Advanced Attributes Window
  4. Click OK to close the Advanced properties window. If you selected a folder, the following dialog will appear:Compress Subfolders RequestThere, you need to choose "Apply changes to this folder only" or "Apply changes to this folder, subfolders and files". Select the required option.

To uncompress the file or folder, untick the checkbox Compress contents to save disk space using the sequence described above and you are done.

Windows 10 comes with a console utility "compact" which can be used to compress individual files and folders.

Compress files and folders in Windows 10 with Compact

The compact.exe app supports the following command line switches and options.

/C Compresses the specified files. Directories will be marked
so that files added afterward will be compressed unless /EXE
is specified.
/U Uncompresses the specified files. Directories will be marked
so that files added afterward will not be compressed. If
/EXE is specified, only files compressed as executables will
be uncompressed; if this is omitted, only NTFS compressed
files will be uncompressed.
/S Performs the specified operation on files in the given
directory and all subdirectories. Default "dir" is the
current directory.
/A Displays files with the 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 is
encountered.
/F Forces the compress operation on all specified files, even
those which are already compressed. Already-compressed files
are skipped by default.
/Q Reports only the most essential information.
/EXE Use compression optimized for executable files which are read
frequently and not modified. Supported algorithms are:
XPRESS4K (fastest) (default)
XPRESS8K
XPRESS16K
LZX (most compact)
/CompactOs Set or query the system's compression state. Supported options are:
query - Query the system's Compact state.
always - Compress all OS binaries and set the system state to Compact
which remains unless administrator changes it.
never - Uncompress all OS binaries and set the system state to non
Compact which remains unless administrator changes it.
/WinDir Used with /CompactOs:query, when querying the offline OS. Specifies
the directory where Windows is installed.
filename Specifies a pattern, file, or directory.

Run the app without parameters to see the compression state of the current directory and any files it contains.

To compress a single file, execute the command:

compact /c "full path of file"

Compress File Windows 10To uncompress a file, run the command

compact /u "full path of file"

See the following screenshot. Uncompress File Windows 10

Here is how to compress a folder:

compact /c "full path of folder"

Compress Folder Without Subfolders Windows 10This will compress the specified folder, but not its subfolders.
Compressed Folder Without Subfolders Windows 10 Compressed Folder Without Subfolders Windows 10 2
To compress the whole contents of the folder, use the command:

compact /c /s:"full path of folder"

Compress Folder With Subfolders Windows 10 Compressed Folder With Subfolders Windows 10

To uncompress only the specified folder without subfolders, run the command

compact /u "full path of folder"

Uncompress Folder Windows 10

To do the same for the folder and all its sudfolders, run the command:

compact /u /s:"full path of folder"

Uncompress Folder With Subfolders Windows 10

That's it.

2 thoughts on “How to Compress Files and Folders in Windows 10

  1. Toshik

    Is it possible to compress the whole disk?

    Reply
    1. Sergey Tkachenko Post author

      Check out the drive properties.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.