General Compress or Uncompress Files and Folders in Windows 11


  • Staff
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


 

Attachments

  • Compress.png
    Compress.png
    1.8 KB · Views: 69
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 3600 & No fTPM (07/19)
    Motherboard
    MSI B450 TOMAHAWK 7C02v1E & IFX TPM (07/19)
    Memory
    4x 8GB ADATA XPG GAMMIX D10 DDR4 3200MHz CL16
    Graphics Card(s)
    MSI Radeon RX 580 ARMOR 8G OC @48FPS (08/19)
    Sound Card
    Creative Sound Blaster Z (11/16)
    Monitor(s) Displays
    24" AOC G2460VQ6 (01/19)
    Screen Resolution
    1920×1080@75Hz & FreeSync (DisplayPort)
    Hard Drives
    ADATA XPG GAMMIX S11 Pro SSD 512GB (07/19)
    PSU
    Seasonic M12II-520 80 Plus Bronze (11/16)
    Case
    Lian Li PC-7NB & 3x Noctua NF-S12A FLX@700rpm (11/16)
    Cooling
    CPU Cooler Noctua NH-U12S@700rpm (07/19)
    Keyboard
    HP Wired Desktop 320K + Rabalux 76017 Parker (01/24)
    Mouse
    Logitech M330 Silent Plus (04/23)
    Internet Speed
    400/40 Mbps via RouterOS (05/21) & TCP Optimizer
    Browser
    Edge (No FB/Google) & Brave for YouTube & LibreWolf for FB
    Antivirus
    NoAV & Binisoft WFC & NextDNS
    Other Info
    Headphones: Sennheiser RS170 (09/10)
    Phone: Samsung Galaxy Xcover 7 (02/24)

Latest Support Threads

Back
Top Bottom