General Compress or Uncompress Files and Folders in Windows 11


Compress_banner.png

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)
Files or folders saved into an existing compressed folder will automatically be compressed.

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:


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.



Contents



EXAMPLE: Files and Folders compressed using NTFS Compression

NTFS_Compression.png





Option One

Compress or Uncompress File(s) in Properties


1 Right click or press and hold on one or more selected file(s), and click/tap on Properties. (see screenshot below)

Compress_file-1.png

2 In the General tab, click/tap on the Advanced button. (see screenshot below)

Compress_file-2.png

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)

Compress_file-3.png

4 Click/tap on OK. (see screenshot below)

Compress_file-4.png




Option Two

Compress or Uncompress Folder(s) in Properties


1 Right click or press and hold on one or more selected folder(s), and click/tap on Properties. (see screenshot below)

Compress_folder-1.png

2 In the General tab, click/tap on the Advanced button. (see screenshot below)

Compress_folder-2.png

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)

Compress_folder-3.png

4 Click/tap on OK. (see screenshot below)

Compress_folder-4.png

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)

Compress_folder-5.png




Option Three

Compress File using Command


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


compress_file_command.png





Option Four

Uncompress File using Command


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


uncompress_file_command.png





Option Five

Compress Folder using Command


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)

(Apply changes to this folder only)​
compact /c "<full path of folder>" /i /Q

OR​

(Apply changes to this folder, subfolders and files)​
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


compress_folder_and_contents_command.png





Option Six

Uncompress Folder using Command


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)

(Apply changes to this folder only)​
compact /u "<full path of folder>" /i /Q

OR​

(Apply changes to this folder, subfolders and files)​
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


uncompress_folder_and_contents_command.png



That's it,
Shawn Brink


 
Last edited:
For the record, you can select a higher compression algorithm, but it will cost you more CPU.
Code:
XPRESS4K (fastest and default value)
XPRESS8K
XPRESS16K
LZX (most compact)

compact /c /i /q /f /exe:lzx /s:C:\
For comparison:
Uncompressed disk: 20GB
Standard compression: 18GB
Maximum compression: 14GB

capture_01212023_153943.jpg
 

My Computer

System One

  • OS
    Windows 11 Home
    Computer type
    PC/Desktop
    CPU
    AMD Ryzen 5 8600G (07/24)
    Motherboard
    ASROCK B650M-HDV/M.2 3.09 (07/24)
    Memory
    2x32GB Kingston FURY DDR5 5600 MHz CL36 @4800 CL40 (07/24)
    Graphics Card(s)
    ASROCK Radeon RX 6600 Challenger D 8G @60FPS (08/24)
    Sound Card
    Creative Sound BlasterX AE-5 Plus (05/24)
    Monitor(s) Displays
    24" Philips 24M1N3200ZS/00 (05/24)
    Screen Resolution
    1920×1080@165Hz via DP1.4
    Hard Drives
    Kingston KC3000 NVMe 2TB (05/24)
    ADATA XPG GAMMIX S11 Pro 512GB (07/19)
    PSU
    Seasonic Core GM 550 Gold (04/24)
    Case
    Fractal Design Define 7 Mini with 3x Noctua NF-P14s/12@555rpm (04/24)
    Cooling
    Noctua NH-U12S with Noctua NF-P12 (04/24)
    Keyboard
    HP Pavilion Wired Keyboard 300 (07/24) + Rabalux 76017 Parker (01/24)
    Mouse
    Logitech M330 Silent Plus (04/23)
    Internet Speed
    500/100 Mbps via RouterOS (05/21) & TCP Optimizer
    Browser
    Edge & Brave for YouTube & LibreWolf for FB
    Antivirus
    NextDNS
    Other Info
    Backup: Hasleo Backup Suite (PreOS)
    Headphones: Sennheiser RS170 (09/10)
    Phone: Samsung Galaxy Xcover 7 (02/24)
    Chair: Huzaro Force 4.4 Grey Mesh (05/24)
    Notifier: Xiaomi Mi Band 9 Milanese (10/24)
    2nd Monitor: AOC G2460VQ6 @75Hz (02/19)

Latest Support Threads

Back
Top Bottom