NTFS Compression by File Extension

Abstract: Compress files by extension on Windows using folder inheritance or the compact command to save disk space.

Created: 2026-08-25 by
You can compress files on Windows by file extension using the built-in NTFS compression feature, though it requires applying attributes to specific folders rather than filtering individual extensions directly. This method reduces disk usage for compatible file types like text documents and logs while maintaining system performance. By combining folder properties with administrative tools, you can effectively manage storage without third-party software.

Understanding NTFS Compression Mechanics

NTFS compression is a feature of the New Technology File System used in Windows operating systems. It allows the operating system to store files in a compressed format on the hard drive while automatically decompressing them when applications need to access or modify them. This process happens transparently to the user and running programs, meaning most software does not need to be aware that a file is compressed.

However, a critical limitation exists: NTFS compression cannot be applied to individual files based solely on their extension through standard graphical user interface options. The compression attribute is stored at the directory level. When you enable compression on a folder, all new files created within that folder inherit the compression setting. Existing files do not automatically compress unless explicitly processed. This architectural constraint means that achieving "compression by file extension" requires a workaround involving targeted directories and batch processing.

Manual Method Using Folder Properties

The most straightforward way to apply compression to specific types of files is to organize them into dedicated folders. Since you cannot select .txt or .log files individually across your entire C: drive via the right-click menu, you must move these files into a container folder first.

  1. Navigate to the Target Directory: Open File Explorer and locate the folder where your target files reside. If they are scattered, create a new subfolder named appropriately, such as Compressed_Text_Files.
  2. Move Files: Select all files with the desired extension (e.g., *.txt) and drag them into the new subfolder. Alternatively, use the Move command from the context menu.
  3. Enable Compression: Right-click the subfolder containing the files and select Properties. Navigate to the General tab and click the Advanced... button near the bottom.
  4. Apply Setting: Check the box labeled Compress contents to save disk space. Click OK, then Apply.
  5. Choose Scope: A dialog will ask if you want to apply changes to this folder only or to all subfolders and files. Select Apply changes to this folder, subfolders and files to ensure existing files are compressed immediately.

This method ensures that any future files added to this folder are also compressed automatically. However, it requires manual intervention each time you wish to compress a different set of files or extensions.

Automating Compression with Command Line Tools

For users who need to compress large numbers of files across various directories without moving them, the command line provides more granular control. While there is no single native command like compress *.pdf, you can use PowerShell or the compact utility to target specific files.

The compact tool is a legacy command-line utility included in Windows that interacts directly with the NTFS compression engine. To compress all text files in a specific directory, open Command Prompt as an Administrator and run the following command:

compact /c /s:C:\Path\To\Folder *.txt

In this command, /c forces compression of already compressed files or marks uncompressed files for compression. The /s:C:\Path\To\Folder parameter specifies the directory scope, ensuring the operation recurses through subdirectories. The *.txt filter restricts the action to only text files. You can replace *.txt with any extension, such as *.log or *.docx.

To verify which files have been compressed, you can use the /u switch instead of /c:

compact /u /s:C:\Path\To\Folder *.txt

This lists the uncompressed files matching the pattern, allowing you to audit the status of your data. Note that frequent use of compression and decompression can increase CPU load during read/write operations, particularly on older hardware.

Performance Implications and Best Practices

While NTFS compression saves significant disk space, it comes with a computational cost. Every time an application reads a compressed file, the CPU must decompress the data into memory before processing it. Similarly, writing data requires compression. For high-speed solid-state drives (SSDs), the bottleneck is often the drive's write endurance or bandwidth rather than raw speed, making compression less impactful on performance compared to traditional spinning hard drives (HDDs).

It is generally recommended to compress files that are rarely accessed or are large but static, such as log files, backups, or archived documents. Compressing frequently accessed active databases or video editing projects may lead to noticeable latency due to the constant decompression overhead. Additionally, some applications may fail if they attempt to modify compressed files directly, so ensure your workflow supports NTFS transparency.

If you find yourself managing complex permission issues alongside compression, such as dealing with deleted users, you might encounter conflicts. In such cases, resolving permissions first is crucial. For more details on handling file permission errors, see Can't remove deleted user from file permissions by command. Conversely, if you are preparing external drives for cross-platform use, remember that APFS on macOS does not support NTFS compression natively. Understanding these differences helps avoid data corruption or inaccessible files, as discussed in Can't Copy Large Files from NTFS Windows Drive to Mac M4 APFS External Drive: A Solution.

Frequently Asked Questions

Does NTFS compression affect file integrity?

No, NTFS compression does not alter the actual content of your files. The data is mathematically compressed on disk and decompressed in RAM upon access, ensuring that the file remains identical to its uncompressed version. Corruption only occurs if there is underlying hardware failure or file system damage unrelated to the compression feature itself.

Can I compress files on a FAT32 or exFAT drive?

No, NTFS compression is exclusive to the NTFS file system. Drives formatted as FAT32 or exFAT do not support this feature because they lack the necessary metadata structures in the Master File Table (MFT). You must convert the drive to NTFS or use third-party archiving tools like ZIP or 7z.

How much disk space can I expect to save?

Savings vary significantly based on file type. Text-based files like .txt, .log, and .csv can often be compressed by 50% to 90%. Media files like .jpg or .mp4 are already compressed algorithmsically and may see negligible savings, sometimes even increasing slightly in size due to compression headers.

Is there a risk of slowing down my PC?

There is a minor performance impact due to CPU usage required for real-time compression and decompression. On modern multi-core processors, this impact is usually unnoticeable for general tasks. However, on older CPUs or during intensive sequential read/write operations, you may observe slight delays.

What happens if I delete a compressed file?

Deleting a compressed file simply removes the data blocks from the disk. The operating system handles the deallocation normally. There is no special cleanup process required for compressed files, and they behave identically to uncompressed files in terms of deletion and recovery potential.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More