This tutorial will show you how to compress or uncompress a file or folder with NTFS Compression in Windows 10 and Windows 11.
The NTFS file system volumes support file compression on an individual file basis. The file compression algorithm used by the NTFS file system is Lempel-Ziv compression. This is a lossless compression algorithm, which means that no data is lost when compressing and decompressing the file, as opposed to lossy compression algorithms such as JPEG, where some data is lost each time data compression and decompression occur.
Data compression reduces the size of a file by minimizing redundant data. In a text file, redundant data can be frequently occurring characters, such as the space character, or common vowels, such as the letters e and a; it can also be frequently occurring character strings. Data compression creates a compressed version of a file by minimizing this redundant data.
While NTFS file system compression can save disk space, compressing data can adversely affect performance. NTFS compression has the following performance characteristics. When you copy or move a compressed NTFS file to a different folder, NTFS decompresses the file, copies or moves the file to the new location, and then recompresses the file. This behavior occurs even when the file is copied or moved between folders on the same computer. Compressed files are also expanded before copying over the network, so NTFS compression does not save network bandwidth.
The /EXE parameter for the compact command uses compression optimized for executable files that are read frequently, but not modified. Supported algorithms are:
- XPRESS4K (fastest and default value)
- XPRESS8K
- XPRESS16K
- LZX (most compact, but uses a lot of CPU resources)
NTFS compressed files and folders will have double blue arrows overlay on their icon at the top right corner to indicate that they are compressed.
References:
File Compression and Decompression - Win32 apps
compact
A file or folder compressed by NTFS Compression is not the same as a Zipped file or folder.
You will only be able to compress or encrypt (EFS) a file or folder. Not both. As a workaround, you could use BitLocker on the drive to encrypt everything on the drive, and then be able to compress what you want.
- Option One: Compress or Uncompress File(s) in Properties
- Option Two: Compress or Uncompress Folder(s) in Properties
- Option Three: Compress File using Command
- Option Four: Uncompress File using Command
- Option Five: Compress Folder using Command
- Option Six: Uncompress Folder using Command
EXAMPLE: Files and Folders compressed using NTFS Compression
1 Right click or press and hold on one or more selected file(s), and click/tap on Properties. (see screenshot below)
2 In the General tab, click/tap on the Advanced button. (see screenshot below)
3 Check (compress) or uncheck (uncompress - default) Compress contents to save disk space for what you want, and click/tap on OK. (see screenshot below)
4 Click/tap on OK. (see screenshot below)
1 Right click or press and hold on one or more selected folder(s), and click/tap on Properties. (see screenshot below)
2 In the General tab, click/tap on the Advanced button. (see screenshot below)
3 Check (compress) or uncheck (uncompress - default) Compress contents to save disk space for what you want, and click/tap on OK. (see screenshot below)
4 Click/tap on OK. (see screenshot below)
5 Select (dot) Apply changes to this folder only or Apply changes to this folder, subfolders and files for what you want, and click/tap on OK. (see screenshot below)
1 Open Windows Terminal, and select either Windows PowerShell or Command Prompt.
2 Type the command below into Windows Terminal, and press Enter. (see screenshot below)
compact /c "<full path of file>" /i /Q
Substitute <full path of file> in the command above with the actual full path of the file you want to compress.
For example: compact /c "C:\Users\Brink\Desktop\File.txt" /i /Q
1 Open Windows Terminal, and select either Windows PowerShell or Command Prompt.
2 Type the command below into Windows Terminal, and press Enter. (see screenshot below)
compact /u "<full path of file>" /i /Q
Substitute <full path of file> in the command above with the actual full path of the compressed file you want to uncompress.
For example: compact /u "C:\Users\Brink\Desktop\File.txt" /i /Q
1 Open Windows Terminal, and select either Windows PowerShell or Command Prompt.
2 Type the command below you want to use into Windows Terminal, and press Enter. (see screenshot below)
compact /c "<full path of folder>" /i /Q
compact /c /s:"<full path of folder>" /i /Q
Substitute <full path of folder> in the command above with the actual full path of the folder you want to compress.
For example: compact /c /s:"C:\Users\Brink\Desktop\Folder" /i /Q
1 Open Windows Terminal, and select either Windows PowerShell or Command Prompt.
2 Type the command below you want to use into Windows Terminal, and press Enter. (see screenshot below)
compact /u "<full path of folder>" /i /Q
compact /u /s:"<full path of folder>" /i /Q
Substitute <full path of folder> in the command above with the actual full path of the compressed folder you want to uncompress.
For example: compact /u /s:"C:\Users\Brink\Desktop\Folder" /i /Q
That's it,
Shawn Brink