How to use compact.exe to free up disk space on Windows

Martin Brinkmann
May 14, 2022
Updated • May 14, 2022
Windows 11 Help

Microsoft introduced new options for the command line tool compact.exe in the Windows 10 operating system. It allows users to compress folders on the system using new algorithms to free up disk space.

Unlike many other compression solutions, compact promises to have little impact on performance when the files need to be loaded by the system. Files are compressed without changing the file extension or location. Decompression happens during runtime, and most modern systems should not break a sweat doing so. The tool is included in Windows 11 as well.

Compact.exe compresses files and folders on Windows without changing filenames or making other modifications to the files. Depending on the type of files, compression may save Gigabytes of disk space or very little. Files that are compressed already, e.g., JPG image files, will show little gains when compress is run on them. Uncompressed files on the other hand may show large gains. You can check out this GitHub page, which lists hundreds of games and programs, and the savings when using compress.exe on them.

A few applications and games may react badly to compression. If that is the case, uncompressing will resolve the issue.

Tip: if you prefer a graphical user interface, check out CompactGUI. Windows includes an option to compress the entire drive. Right-click on any drive in explorer and select Properties to open the option. You find "Compress this drive to save disk space" under General in the properties window.

Using compact.exe on Windows

You may run the program from any command prompt window. Open a new command prompt window, e.g., by using Windows-R to open the run box, typing cmd.exe and hitting the Enter-key on the keyboard.

Running compact on its own displays the compression status of all folders and files of the current directory.

The command line tool support several parameters, some of which may be confusing at first.

The core commands compact.exe /c and compact.exe /u mark the current or specified directories so that future changes to the folder, e.g., modified files or newly added files, are compressed or uncompressed.

It is necessary to supply the /s parameter to the command to perform the selected operation on all files in the specified directory and all of its subdirectories.

By default, the current directory is used, but a directory may be supplied to perform the operation on a different directory instead. To do that, add path information to the command.

The command compact.exe /c /s:c:\users\test\downloads\ runs the compression on the downloads directory.

You may specify the compression algorithm by supplying the /EXE parameter. The parameter /EXE:XPRESS8K uses that algorithm. The following algorithms are supported:

  • XPRESS4K (fastest and default value)
  • LZX (most compact)

The default algorithm is designed to make the performance impact as minimal as possible, even on older systems. Most devices should not have issues using the 8k or even 16k algorithm instead.

Other useful parameters of compact.exe:

  • /f forces the compression or uncompression. Already compressed or uncompressed files are skipped. Should be used if the process was interrupted, e.g., by a crash.
  • /i ignores errors and continues the operation without stopping.
  • /? displays help information.

Closing Words

Large program and game folders, and folders with large uncompressed files, benefit the most from the compression. Gigabytes of disk space may be recovered with the help of the command. Most Windows users may use the CompactGUI program instead, as it is easier to use and handle.

Now You: have you used compact.exe in the past?

How to use compact.exe to free up disk space on Windows
Article Name
How to use compact.exe to free up disk space on Windows
Find out how to save Gigabytes of disk space on Windows devices with the help of the native compact.exe command line tool.
Ghacks Technology News

Tutorials & Tips

Previous Post: «
Next Post: «


  1. John G. said on August 21, 2023 at 2:38 pm

    There is not still W11 23H2 and these instructions are nonsense by now. :[

    1. James said on August 21, 2023 at 8:48 pm

      It worked for me just fine. You’re probably not following the instructions clearly.

      1. Katrina Thompson said on August 30, 2023 at 3:25 am

        Just tried the password option and the OOBE option and didnt work.

    2. Anonymous said on September 7, 2023 at 10:33 am

      Worked perfectly. Thank OP.

    3. Anonymous said on September 15, 2023 at 11:26 am

      Worked perfectly for me just now. Specifically, the regedit option.

  2. 45 RPM said on August 22, 2023 at 9:02 am

    Is this cut and paste from a Microsoft PR paper, because it 1000% BS:

    “By listening to user insights, Microsoft has demonstrated its commitment to refining the Windows experience based on real-world needs.”

    Windows 11 is proof they don’t give a s*it.

    1. elong45 said on August 23, 2023 at 12:25 am

      Worked for me just now

    2. Robert N said on August 28, 2023 at 10:55 pm

      I agree! Windows 11 was a downgrade to me and I kept all 8 computers in our family on Windows 10 as a result. They didn’t listen to any customers. The taskbar was THE main reason I stayed away from Windows 11. With 6 monitors, it is impossible to navigate so many browser tabs, without the feature. I will try the new version in the virtual box to see if it is worth it yet.

  3. Anonymous said on August 23, 2023 at 11:33 pm

    Microsoft did a terrible job with this implementation.

    They simply need to employ the creator of StartAllBack to fix Windows. He is smarter and more talented than the entire campus of Microsoft employees.

    1. Anonymous said on September 4, 2023 at 11:36 pm


  4. Joe Mama said on August 24, 2023 at 12:10 am

    Thank you so much! I work in IT and this is extremely useful information!

  5. Anonymous said on August 27, 2023 at 9:34 pm

    Thanks man. The second method worked great!

  6. Anonymous said on August 28, 2023 at 1:16 pm

    I used the second method, and i got exactly what i expected.

  7. adrian said on September 1, 2023 at 12:52 am

    Using the Bypass 2: Use a banned email address email worked fantastically as I had gone to far to use the bypass 1.
    I will be back when I next have a problem.
    Keep you the great work

  8. John G. said on September 4, 2023 at 6:15 pm

    W11 File Explorer is the worst crap ever done. W11 is the biggest shame ever.

  9. MarineRecon said on September 4, 2023 at 9:14 pm

    Just one more reason for me to go to Linux when Windows 10 ages out.

    1. TelV said on September 19, 2023 at 11:46 am

      @ MarineRecon,

      Be careful which Linux distro you choose. Some of them don’t include the Wayland protocol which is a security issue i.e. apps can copy, paste and inject data without user interaction.

      It’s included in Fedora:

  10. Dustyn said on September 4, 2023 at 9:28 pm

    How about a DARK MODE for your website? That would be oh so nice.

    1. Tom Hawack said on September 5, 2023 at 12:55 am

      Something like this : [] maybe?
      Done with ‘Dark Reader Extension for ? Firefox’ []

      This comment was written on [}

    2. TelV said on September 19, 2023 at 11:49 am

      Definitely NOT! Once you get older and your eyesight starts to fail you’ll positively loathe dark mode.

  11. Anonymous said on September 5, 2023 at 2:05 am

    Microsoft completely ruined File Explorer by converting to XAML/WinUI/whatever new bloated modern garbage. Its worse than it ever was.

  12. Invoker said on September 5, 2023 at 3:32 pm

    i tested it on win10 current edition. speeds up explorer like a charm

  13. LOEL LARZELERE said on September 13, 2023 at 8:07 am

    SO what is the priority numbers to give preference to ethernet over wireless?

  14. christop_bader said on September 14, 2023 at 1:50 am

    Worked very well happy to have Windows Photo Viewer back in action in Windows-11

  15. Anonymous said on September 16, 2023 at 4:29 am

    Worked for me (registry option) thank god, I can use the search option to find things on my computer again. Thank you so much!

    1. TelV said on September 19, 2023 at 11:54 am

      Install Everything Search and dispense with Microsoft’s crappy search tool.

      Martin wrote an article on it:

  16. said on September 17, 2023 at 6:39 pm

    I presume the text “WindowsCopilot,,” is a typographical error (2023/09/17/how-to-disable-windows-copilot-in-windows/). The broken comment system unfortunately looks like it is populating itself via AI autopilot.

  17. Anonymous said on September 17, 2023 at 10:37 pm

    Hopefully, this Windows Copilot nonsense fails even more spectacularly than Cortana. Who requested this? We want all of the UX features removed back in 11, not this copilot nonsense.

  18. Anonymous said on September 17, 2023 at 10:51 pm

    I really don’t mind all of these Windows enhancement but Microsoft get one thing very wrong. ‘Opt in’, is far better than seek information and work to disable.

  19. ilev said on September 18, 2023 at 7:13 am

    Turn off Windows Copilot entirely is not good enough.

    How to uninstall Copilot entirely ?

    1. TelV said on September 19, 2023 at 11:57 am

      @ ilev,

      Use Gpedit or the registry. Explained in this article:

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.