Compress individual files on NTFS with compact

Transparent per-file NTFS compression — files stay directly readable, no zip archive required.

WindowsFilescompressionntfsLow risk
Run compact /c <file-or-folder> to enable NTFS compression, and compact /u <file-or-folder> to reverse it.

01Command

Command
$ compact /c /i /q C:\Logs\*.log

02What it does

compact applies the NTFS compressed attribute, so the OS decompresses files on read automatically and every application sees them normally. It is per-file/folder and separate from compactos, which compresses Windows' own binaries. Compression works best on text-like data (logs, documents) and does nothing for already-compressed media. compact /s:<dir> applies to a whole subtree.

03Risk

RiskLow risk
RequirementsNTFS filesystem
!Warning: Compressed NTFS files incur a small CPU cost on every access, and network/SMB copies may lose the compression attribute.

04Undo

Undo
$ compact /u /i /q C:\Logs\*.log

05Sources

  • COMPACT - Windows CMD
    SS64 · technical · 2026-09-17
    Evidence: SS64 explains compact as NTFS per-file compression, distinct from compactos whole-OS binary compression, with /c, /u and wildcards.
  • compact | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents compact /c to compress NTFS files or directories and /u to uncompress them, with /i to ignore errors and /q for quiet reporting.

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions