How to shrink installed Steam games with Windows’ built-in compression (compact.exe)

By Factodus · updated

Windows 10 and 11 can store files compressed and decompress them on the fly whenever a program reads them. The feature is called the Windows Overlay Filter (WOF), and the command-line tool that drives it ships with Windows: compact.exe. Pointed at a game folder, it can free hundreds of megabytes per game while the game keeps running from the same files. Nothing is repacked, and nothing has to be extracted before you play.

This guide shows the exact commands, how to check what you saved, how to undo it, and where it goes wrong.

Short version. Close the game, then in Command Prompt run compact /c /s /a /i /exe:lzx "D:\SteamLibrary\steamapps\common\YourGame\*". To undo: compact /u /s /a /i /exe "D:\SteamLibrary\steamapps\common\YourGame\*". Keep the \* at the end of the path; the reason is in step 3.

What you need

  • Windows 10 or 11. The /exe algorithms used here arrived with Windows 10.
  • The game on an NTFS drive. compact works on NTFS only; it cannot compress FAT or FAT32 drives.
  • The game closed, and ideally no update or download running for it in Steam.
  • No room for a second copy. Compression works file by file, so you do not need free space for a copy of the whole game.

You do not need administrator rights for a folder you can write to, which is normally the case for Steam libraries. If compact answers Access is denied for a folder, run Command Prompt as administrator.

Step 1: find the game folder

In Steam, right-click the game in your library, then choose Manage › Browse local files. Explorer opens the install folder, usually something like C:\Program Files (x86)\Steam\steamapps\common\Unturned or D:\SteamLibrary\steamapps\common\Unturned. Click the address bar and copy the path. The examples below use a library on drive D:; put in your own path.

Step 2: see where you start

Open Command Prompt (press Win, type cmd, Enter). The commands below also work in PowerShell and Windows Terminal. First ask compact for the current state:

compact /s /a /q "D:\SteamLibrary\steamapps\common\Unturned\*"
  • /s includes every subfolder,
  • /a includes hidden and system files,
  • /q prints only the summary.

The last lines look like this (numbers from a test folder):

Of 3 files within 1 directories
2 are compressed and 1 are not compressed.
50,331,648 total bytes of data are stored in 33,132,544 bytes.
The compression ratio is 1.5 to 1.

Before compression, the two byte counts are equal and the ratio is 1.0 to 1. You can also note Size and Size on disk in the folder’s Properties window in Explorer.

Step 3: compress

compact /c /s /a /i /exe:lzx "D:\SteamLibrary\steamapps\common\Unturned\*"

What each switch does, per Microsoft’s documentation of compact:

Switch Meaning
/c Compress.
/s Include all subfolders.
/a Include hidden and system files; they are skipped by default.
/i Keep going when a file fails, for example one that is locked. By default compact stops at the first error.
/exe:lzx Use the compression meant for files that are read often and rarely changed. The algorithm is one of XPRESS4K (the default and fastest), XPRESS8K, XPRESS16K or LZX (the most compact).

Why the \* matters. compact treats the last argument as a file name pattern. We tried both forms on a test folder. Given the bare folder path, compact reported that 0 files were compressed, because it searched for files named like the folder. With \* added to the path, every file in the folder and its subfolders was compressed. Two other forms work as well: compact /c /s:"D:\...\Unturned" /a /i /exe:lzx, or cd /d into the folder first and pass *.

LZX compresses slowly. On our PC, 48 MB of synthetic test data took about 4 seconds with LZX and well under a second with any XPRESS variant, so a large game can take many minutes. That cost is paid once. If you want the quickest pass, use /exe:xpress8k or leave the algorithm out for XPRESS4K. The trade-offs between the four are covered in LZX vs XPRESS for games.

Files that are already compressed with an /exe algorithm are skipped. To switch a game from one algorithm to another, add /f (force), for example compact /c /s /a /i /f /exe:lzx "...\*". Without /f, a folder compressed with XPRESS4K stays XPRESS4K.

Step 4: check the result

Run the same query as in step 2:

compact /s /a /q "D:\SteamLibrary\steamapps\common\Unturned\*"

The second byte count is what the game now occupies. For a per-file view, drop /q; each line shows the file’s size, its stored size, and the ratio. Explorer’s Properties window shows the same thing as Size on disk.

For scale, these are our own LZX results on four Steam games: Dota Underlords freed 805 MB, Unturned 752 MB, Stumble Guys 599 MB, and Brawlhalla only 22 MB. The next section explains the Brawlhalla number.

Step 5: play, and verify if anything looks wrong

Start the game as usual. The files are where they were, with the same names and contents; Windows decompresses data as the game reads it.

If a game misbehaves after compression, or you are unsure, let Steam check it: right-click the game, Properties › Installed Files › Verify integrity of game files. Steam compares every file with its manifest and fixes what does not match. In our tests we ran it after every compress, decompress and cancel, and Steam never had to redownload a file, because WOF gives programs exactly the original bytes.

How to undo it

compact /u /s /a /i /exe "D:\SteamLibrary\steamapps\common\Unturned\*"

/u uncompresses. With /exe, it targets files compressed with one of the /exe algorithms, which is what you want here; without /exe, it only touches classic NTFS compression. The game needs its full size back on the drive, so check free space first.

Caveats you should know before doing your whole library

Game updates undo part of the work. When a program opens a WOF-compressed file for writing, Windows turns it back into a normal, uncompressed file. New files are not compressed either: unlike compact /c without /exe, the /exe mode does not mark the folder so that new files get compressed. We checked both on a test folder. After every update, the files that changed take their full size again, and you have to run step 3 again. Only the changed files take time; the rest are skipped as already compressed.

Already-compressed data gains almost nothing. Video, most audio formats and many engines’ packed archives are compressed already. compact still walks through them, but WOF keeps a file stored as it was when compression does not make it smaller. A game made mostly of such data, like Brawlhalla in our tests, frees very little. That is not a failure; there is simply nothing left to squeeze.

Anti-cheat: untested. We have not tested games that use anti-cheat systems. The files are byte-for-byte the same when read, but we cannot tell you how a given anti-cheat reacts, so do one such game at a time, and remember you can undo it.

DirectStorage games. The CompactGUI project advises against compressing games that use DirectStorage on Windows 11, because the data then has to be decompressed by the CPU before it can reach the GPU, which works against the point of DirectStorage. We have not measured this ourselves.

Reads cost some CPU. Decompression happens at read time. In our tests load times showed no noticeable difference, but that is our experience on our hardware, not a guarantee. If a game stutters or loads slower, undo it for that game.

Do not compress while Steam is writing. Close the game and let downloads and updates finish first. The /i switch skips files that are locked, but a half-updated folder is not something to experiment on.

When a GUI is worth it

The commands above are all you need for one or two games. A GUI earns its place when you have many games, want to know what each one will give back before spending time on it, or want updated games re-compressed without remembering to do it. There are two options we can recommend honestly:

  • CompactGUI is free and open source (GPL-3.0). It uses the same Windows API, offers the same four algorithms, and has a background watcher that re-compresses games after updates. It also shows compression results that other users submitted for Steam games. If free matters most, start here.
  • ShelfSpace is our own app, $4.99 on itch.io. It samples each game with the real algorithm and shows a low–high estimate before anything is touched, compresses in parallel with pause, resume and cancel, re-compresses after updates from the tray, cleans up leftovers and stale shader caches, and has four animated themes. Steam libraries are found automatically; other folders are added by hand.

Both do what compact.exe does under the hood, and both can undo it. Whichever you pick, the caveats above still apply.

Sources

The behaviour of the bare folder path, of /f and of writes to compressed files was checked by us with compact.exe on synthetic test files in a scratch folder on Windows 10.