Compact OS — Compress the OS to Free Up Disk Space
Compact OS runs Windows directly from compressed files, saving between 2.75 GB and 4.75 GB without deleting files or impacting performance on SSDs. Can be enabled or disabled at any time from CMD.
SystemWindows 10 / 11
Typical savings2.75 GB – 4.75 GB
PrivilegesAdministrator
Case 1 — Check current status
From running Windows (CMD as Administrator)
Compact.exe /CompactOS:Query
Compact.exe /CompactOS:Query /WinDir:E:\Windows
Case 2 — Enable / Disable Compact OS
Enable — Windows runs from compressed files (recommended on SSDs)
Compact.exe /CompactOS:always
Compact.exe /CompactOS:never
Case 3 — Apply compressed image with DISM (WinPE / deployment)
Applies install.wim directly in compact mode when installing Windows
DISM /Apply-Image /ImageFile:install.wim /Index:1 /ApplyDir:D:\ /compact
Case 4 — Clean and export offline image with DISM
Mount image
Dism /Mount-Image /ImageFile:"C:\Images\install.wim" /Index:1 /MountDir:C:\mount\Windows
Dism /Cleanup-Image /Image=C:\mount\Windows /StartComponentCleanup /ResetBase
Dism /Unmount-Image /MountDir:C:\mount\Windows /Commit
Dism /Export-Image /SourceImageFile:C:\Images\install.wim /SourceIndex:1 /DestinationImageFile:C:\Images\install_cleaned.wim
Case 5 — Shrink hiberfil.sys (additional savings)
Reduce by 30% — keeps hibernation active
powercfg /h /type reduced
powercfg /h off
Compact OS optimal on SSD · Not recommended on rotational HDD
Microsoft Docs