You may have tried to compress a file or folder in Windows 11 only to see an error stating the operation cannot be performed because the item is encrypted. Or you might have attempted to encrypt a compressed file and received a similar failure. This conflict occurs because NTFS, the default file system in Windows 11, enforces a strict rule: a file or folder can be either compressed or encrypted, but never both at the same time. The root cause lies in how NTFS manages data on disk. This article explains the technical reason for this restriction, shows you how to check and change these attributes, and clarifies related limitations you should know.
Key Takeaways: NTFS Compression and Encryption Cannot Be Combined
- File Properties > Advanced Attributes: Use this dialog to view or change Compression and Encryption settings for any file or folder.
- Compact.exe command-line tool: Use this to compress files and folders when the GUI is not available or for scripting.
- Cipher.exe command-line tool: Use this to encrypt or decrypt files and folders from the command line.
Why NTFS Blocks Simultaneous Compression and Encryption
NTFS stores two separate attribute flags in the file system metadata: FILE_ATTRIBUTE_COMPRESSED and FILE_ATTRIBUTE_ENCRYPTED. These flags instruct the operating system how to read and write data to disk. When compression is enabled, NTFS divides a file into 16-cluster blocks, compresses each block individually, and writes the compressed block to disk. The file system tracks the compressed size of each block in a separate data structure called the compression unit.
When encryption is enabled, NTFS uses the Encrypting File System feature. EFS encrypts the file data using a symmetric key called the File Encryption Key. The FEK is then encrypted with a user-specific public key and stored in a special attribute called the Data Decryption Field. EFS operates at the byte-stream level, meaning it encrypts the entire uncompressed data stream.
The Technical Conflict
The conflict arises because the two features require incompatible low-level data access patterns. Compression requires NTFS to read and write compressed blocks, while EFS requires NTFS to read and write the raw encrypted byte stream. If both attributes were applied, the file system would not know the order of operations. Should it compress first and then encrypt the compressed data, or encrypt first and then compress the encrypted data? Both approaches break the assumptions of the other feature.
If compression were applied before encryption, the compression algorithm would operate on encrypted data. Encrypted data appears as random noise to compression algorithms, so compression would yield no space savings and could even increase file size. If encryption were applied before compression, the encryption algorithm would receive compressed data. The compressed data is already optimized, and encrypting it would not affect its size. However, NTFS does not support this ordering because the compression and encryption drivers are independent and expect to handle the final, uncompressed data stream.
Microsoft chose to block the combination entirely rather than implement a complex, error-prone ordering system. This design decision keeps the file system code simpler and avoids potential data corruption scenarios. The restriction is enforced at the file system driver level in the Windows 11 kernel.
How to Check and Change Compression or Encryption Attributes
Before you can apply one attribute, you must remove the other. Follow these steps to view and change the attributes on a file or folder.
- Open the file or folder properties
Right-click the file or folder in File Explorer and select Properties from the context menu. - Access advanced attributes
In the Properties dialog, click the Advanced button on the General tab. This opens the Advanced Attributes dialog. - Check the current attribute state
In the Compress or Encrypt attributes section, you will see two checkboxes. Only one can be active. If the checkbox for Compress contents to save disk space is checked, the file is compressed. If the checkbox for Encrypt contents to secure data is checked, the file is encrypted. The other checkbox will be grayed out and unavailable. - Remove the existing attribute
To change the attribute, uncheck the currently active checkbox. Click OK in the Advanced Attributes dialog, then click OK or Apply in the Properties dialog. Windows will uncompress or decrypt the file. - Apply the new attribute
Open the Advanced Attributes dialog again. Check the checkbox for the attribute you want to enable. Click OK in both dialogs. If you are encrypting a folder, Windows will ask whether you want to apply the change to all subfolders and files. Select the appropriate option and click OK.
Using Command-Line Tools
You can also manage these attributes from the command line. Open Command Prompt or PowerShell as Administrator.
To compress a file or folder, use the compact command. For example, to compress the folder C:\Data and all its contents:
compact /C /S:C:\Data
To uncompress the same folder:
compact /U /S:C:\Data
To encrypt a file or folder, use the cipher command. For example, to encrypt the folder C:\Data:
cipher /E /S:C:\Data
To decrypt the same folder:
cipher /D /S:C:\Data
If you attempt to set an attribute that conflicts with the current one, the command will fail and display an error message. For example, running cipher /E on a compressed file produces: “The specified file cannot be encrypted.”
Common Misunderstandings and Edge Cases
“Can I compress an encrypted file if I use a different tool?”
No third-party tool can bypass the NTFS restriction. The limitation is enforced at the file system driver level, not in the Windows shell. Any tool that reads or writes the file through standard NTFS APIs will be blocked. Tools that attempt to manipulate the file system metadata directly risk data corruption.
“Does this restriction apply to folders as well?”
Yes. The restriction applies to both files and folders. If you mark a folder as encrypted, all new files created inside that folder will be encrypted. You cannot set the compressed attribute on that folder or any file within it. Similarly, a compressed folder cannot contain encrypted files.
“What about BitLocker? Does it conflict with compression?”
BitLocker operates at the volume level, not the file level. It encrypts the entire disk partition before the file system even sees the data. BitLocker does not conflict with NTFS compression because compression is applied to the data after BitLocker has decrypted the volume. A BitLocker-encrypted drive can contain compressed files without any issues.
“Can I compress or encrypt system files?”
Windows 11 protects critical system files from having these attributes changed. Attempting to compress or encrypt files in the Windows folder or the root of the system drive will either fail or produce a warning. The Windows folder is excluded from compression by default because compressing system files can degrade performance and cause boot issues. Encryption of system files can prevent the operating system from loading properly.
| Item | NTFS Compression | EFS Encryption |
|---|---|---|
| Scope | File and folder level | File and folder level |
| Data transformation | Reduces disk space by compressing 16-cluster blocks | Encrypts data with a symmetric key per file |
| Compatibility with each other | Cannot coexist on the same file or folder | Cannot coexist on the same file or folder |
| Compatibility with BitLocker | Fully compatible | Fully compatible |
| Performance impact | Slows read/write on compressible data; speeds up read on highly compressible data | Adds CPU overhead for encryption and decryption |
| Backup behavior | Backup software sees compressed data; restores as compressed | Backup software sees encrypted data; requires EFS certificate to restore |
The key difference is that compression and encryption are mutually exclusive at the file and folder level. BitLocker works independently at the volume level and does not interfere with either attribute.
You now understand why compressed and encrypted attributes cannot coexist on NTFS in Windows 11. The restriction is a deliberate design choice to avoid data corruption and maintain file system stability. When you need both space savings and data protection, use BitLocker for volume-level encryption and NTFS compression for individual files or folders. To manage attributes efficiently, use the Advanced Attributes dialog in File Properties or the compact and cipher command-line tools.