NTFS compression

On this page 7

NTFS compression is a built-in file system feature in Windows that stores file data on an NTFS volume in compressed form and decompresses it transparently whenever an application reads it. Within Windows storage & file systems, it is the oldest native space-saving mechanism, available since Windows NT 3.51, and it works per file or per folder through a simple compression attribute.

Because the file system performs the work, applications see ordinary files of their original logical size and need no changes. The trade-off is extra CPU work and fragmentation in exchange for disk space, a balance that has shifted considerably as storage became cheaper and processors faster.

How NTFS compression stores data

NTFS compression uses the LZNT1 algorithm, a variant of LZ77 designed for fast decompression. The file system divides each file into compression units of 16 clusters, which equals 64 KB on a volume with 4 KB clusters, and compresses each unit independently.

If a unit shrinks by at least one cluster, NTFS writes the smaller version and records the saved clusters as unallocated sparse runs. If compression does not save a full cluster, the unit is stored uncompressed. This unit-based design allows random access: reading a byte in the middle of a large file requires decompressing only one 64 KB unit, not the entire file.

The following table lists the key technical parameters that determine how the feature behaves.

ParameterValue or behaviorPractical effect
AlgorithmLZNT1 (LZ77 family)Fast, moderate compression ratio
Compression unit16 clusters, 64 KB at 4 KB clustersRandom access stays efficient
Supported cluster size4 KB or smallerUnavailable on volumes with larger clusters
GranularityPer file or per folderSelective use is possible
Typical savingRoughly 30-60% on text, near 0% on mediaDepends entirely on data type
Core parameters of NTFS compression

Enabling and managing compression

Users enable compression through File Explorer by opening a file’s or folder’s Properties, choosing Advanced and selecting Compress contents to save disk space. Explorer can display compressed items with blue file names, a visual cue that the attribute is set.

Administrators usually prefer the command line. The compact utility sets, clears and reports the attribute, while fsutil behavior set disablecompression 1 prevents compression system-wide on NTFS volumes. Setting the attribute on a folder makes new files inherit compression, but existing files change only when the operation is applied to them.

CommandPurpose
compact /c /s:D:\LogsCompress a folder tree and mark it for new files
compact /u file.datDecompress a single file
compact /q /s:D:\LogsReport compression ratio summary
fsutil behavior set disablecompression 1Disable the feature on the system
Common commands for NTFS compression

Copy and move operations follow a clear rule. A file copied into a compressed folder becomes compressed, and a file moved within the same volume keeps its original state. A file moved to another volume behaves like a copy and takes on the target folder’s attribute.

NTFS compression is one of several space-saving mechanisms in modern Windows, and they differ in algorithm, scope and write behavior. The newer Windows Overlay Filter (WOF) compression, used by Compact OS and by compact /exe, achieves better ratios but suits files that rarely change.

MechanismAlgorithmBest suited forBehavior on write
NTFS compressionLZNT1Logs, documents, rarely read archivesRecompresses transparently
WOF compressionXPRESS 4K to 16K, LZXProgram and system filesFile reverts to uncompressed
Compact OSWOF with XPRESSWhole Windows installationUpdates may restore files uncompressed
ZIP archiveDeflateTransfer and long-term storageRequires explicit extraction
Comparison of Windows space-saving options

NTFS compression is also mutually exclusive with the Encrypting File System: a file can be compressed or encrypted with EFS, but not both. ReFS does not offer this feature in the same form, and BitLocker operates at the volume level, so it combines freely with compressed files.

Performance and where compression makes sense

The performance impact depends on the ratio between CPU speed and disk speed. On slow hard drives, reading fewer physical clusters could offset the decompression cost, and compressed text files sometimes opened faster than uncompressed ones. On fast NVMe SSDs, the storage is rarely the bottleneck, so compression adds CPU overhead without speed benefit.

Write-heavy files suffer most. Every modification forces NTFS to recompress the affected unit, and a unit that grows may need new clusters elsewhere, which causes heavy fragmentation over time.

WorkloadRecommendationReason
Text logs and old documentsGood candidateHigh ratio, infrequent rewrites
JPEG, MP4, ZIP filesAvoidAlready compressed, no saving
Database and VHDX filesAvoidRandom writes cause fragmentation and latency
Small SSD with archive dataReasonableRecovers space with little cost
Suitability of NTFS compression by workload

Limitations and common mistakes

The most frequent mistake is compressing an entire system drive to recover space. This slows updates and application launches and gives limited gain, because executables and media compress poorly with LZNT1. Compact OS is the supported option for shrinking a Windows installation.

  • Free-space reports can mislead: Explorer shows both size and size on disk, and only the latter reflects the saving.
  • Copying to another drive or the network transfers the full uncompressed data.
  • Large cluster sizes, such as 64 KB volumes formatted for databases, disable the option entirely.
  • Backup software may read and transmit uncompressed data, so backup volumes do not shrink accordingly.

In plain words

NTFS compression lets Windows squeeze files so they take less room on the disk. You still see and open the files normally, and Windows quietly unpacks them each time a program needs them.

It is a bit like vacuum-packing clothes in a suitcase. You save space, but packing and unpacking takes a little effort every time. The key takeaway: it helps with files that contain mostly text and rarely change, and it does little for photos, videos or files that change constantly.

A real-world example

A systems administrator at a small manufacturing company runs a Windows Server that collects machine logs in plain text on a 500 GB data volume. The logs grow by about 4 GB per week and must be kept for two years, and the volume is approaching 90% utilization.

The administrator runs compact /c /s:D:\MachineLogs overnight to apply NTFS compression to the log folder. Because the logs are repetitive text, the folder shrinks from 310 GB to roughly 120 GB of space on disk, and new log files are compressed automatically as they are written. CPU usage on the server rises only slightly during writes, and the purchase of additional storage is postponed by more than a year.