free webpage hit counter

How to shrink files and folders in Windows with Compact.exe

Are you running out of disk space but can’t delete files or get a bigger hard drive? Here’s one way you can get more space.

Are you running out of disk space on your Windows machine? If installing a larger storage drive or deleting files and folders isn’t an option, compressing files and folders on your computer is a great way to create more space. The good thing is that Windows has a built-in utility that you can call compact.exe.


Here’s how to use compact.exe to compress files and folders on your Windows PC to save disk space.

What is compact.exe in Windows?

In short, compact.exe is a Windows utility that reduces the size of files and folders on storage drives that use the NTFS file system without losing any data.

Depending on the type of compression you choose and the file types being compressed, you’ll get different levels of compression. It can range from a few megabytes to entire gigabytes.

For file types that are already compressed, such as JPEG and ZIP, you won’t notice much of a size difference (if any) when compressing them with compact.exe. This can slow access. So it is better not to use a utility to compress those types of files.

Compact.exe uses advanced compression algorithms to compress files and ensure their contents are still accessible. These algorithms—from fastest, least compact to slow, most compact—are XPRESS4K, XPRESS8K, XPRESS16K, and LZX.

How to compress files with Compact.exe

To use Compact.exe, you need a command line tool—either Command Prompt or Windows PowerShell. We are going to use the latter.

To use compact.exe to compress files, follow the steps below.

  1. press Win + S Start Windows Search and then enter PowerShell In the search box.
  2. Click Windows PowerShell To launch the application.
  3. To compress a single file, you must enter a command with the following structure:
    compact [file path]

    Just change file path in square brackets above with the actual path to the file. In PowerShell, it should look like the screenshot below.

    By default, compact.exe uses the XPRESS4K algorithm to compress the file. To use a specific algorithm, use the following command structure:

    compact /exe:[algorithm] [file path]

    You need to change Algorithm with the name of the actual algorithm you want to use in square brackets above. So if you are going to use the XPRESS8K algorithm, the command structure is as follows:

    compact /exe:XPRESS8K [file path]
  4. Hit Enter key and compact.exe will compress the file and show you the results.


As long as you follow the steps above, compressing a file with compact.exe should be a piece of cake.

How to compress folders with Compact.exe

To use compact.exe to compress an entire folder, follow the steps below.

  1. press Win + S Start Windows Search and then enter PowerShell In the search box.
  2. Click Windows PowerShell To launch the application.
  3. Within PowerShell, navigate to the directory or folder with the files you want to compress. The command to do that has the following structure:
    cd [folder path]

    You just need to change folder path in square brackets above with the actual path to the directory. Since the folder we want to compress is on the desktop, the screenshot below shows what the command looks like in PowerShell.

  4. Once PowerShell is in the desired directory, enter the following command:
    compact /c

    By default, compact.exe uses the XPRESS4K algorithm to compress the folder. To select a different algorithm, use the following command structure:

    compact /exe:[algorithm]

    change Algorithm in square brackets above with the name of the actual algorithm you want to use. So, if you want to use the XPRESS8K algorithm, here’s what the command you’d enter in PowerShell would look like:

    compact /exe:XPRESS8K
  5. press Enter key, and the utility compresses the files in the folder and then displays the compressed results.


How easy it is to use compact.exe to compress folders in Windows.

Compressing files and folders locally in Windows

When you run out of storage space on your Windows computer, there are many things you can do to create more space without adding a bigger drive or deleting files you’ll need later.

With Compact.exe, you can compress files with a simple command in Command Prompt or PowerShell. No need to use a third party compression tool. If you want a more graphical way to use compact.exe, you can look at CompactGUI.

Leave a Reply

Your email address will not be published.

Previous post The MOCA show highlights art that defies borders
Next post The “Resilient” exhibition with three artists opens on 2 September in Aurora