What is a Compressed File?

Explanation of the Compressed Attribute & Whether or Not You Should Enable It

Picture of three Rubik's Cubes that are different sizes
© Núria Talavera / Moment Mobile / Getty Images

A compressed file is any file with the compressed attribute turned on.

Using the compressed attribute is one way to compress a file down to a smaller size to save on hard drive space, and can be applied in a few different ways (which I talk about below).

Most Windows computers are configured by default to display compressed files in blue text in normal file searches and in folder views.

How Does Compression Work?

Turning on the compressed file attribute for a file will reduce the size of the file but will still allow Windows to use it just like it would any other file.

The compression and decompression happens on-the-fly. When a compressed file is opened, Windows decompresses it for you automatically. When it closes, it gets compressed again. This happens over and over as many times as you open and close a compressed file.

I turned on the compression attribute for a 25 MB TXT file to test the effectiveness of the algorithm Windows used. After compression, the file was using only 5 MB of disk space.

Even with just this one example, you can see how much disk space could be saved if this were applied to many files at once.

Should I Compress an Entire Hard Drive?

As you saw in the TXT file example, setting the compressed file attribute on a file can substantially reduce its size. However, working with a file that is compressed will use more processor time than working with an uncompressed file because Windows has to decompress and recompress the file during its use.

Since most computers have plenty of hard drive space, compression isn't usually recommended, especially since the trade off is an overall slower computer thanks to the extra processor usage needed.

All that said, I do think it may be beneficial to compress certain files or groups of files if you hardly ever use them.

If you don't plan on opening them often, or even at all, then the fact that they will require processing power to open is probably of very little concern on a day-to-day basis.

Note: Compressing individual files is pretty easy in Windows thanks to the compressed attribute, but using a 3rd party file compression program is best for archiving or sharing. See this List of Free File Extractor Tools if you're interested in that.

How to Compress Files & Folders in Windows

Both Windows Explorer and the command-line command compact can be used to compress files and folders in Windows by enabling the compressed attribute.

Microsoft has this tutorial that explains compressing files using the Windows Explorer method, while examples on how to compress files from a Command Prompt, and the proper syntax for this command-line command, and can be seen here (also from Microsoft).

Compressing a single file of course applies the compression to just that one file. When compressing a folder (or an entire partition), you're given the option to compress just that one folder, or the folder plus its subfolders and all the files that are found within them.

Compressing a folder using Windows Explorer gives you two options: Apply changes to this folder only and Apply changes to this folder, subfolders and files.

The first option for applying the changes to the one folder you're in will setup the compression attribute only for new files that you put into the folder. This means any file that's in the folder right now will not be included, but any new files you add in the future will be compressed. This is true only for the one folder you apply it to, not any subfolders that it may have.

The second option - to apply the changes to the folder, subfolders, and all of their files - does just as it sounds. All the files in the current folder, plus all the files in any of its subfolders, will have the compressed attribute toggled on. This not only means that the current files will be compressed, but also that the compressed attribute is applied to any new files you add to the current folder as well as any subfolders, which is where the difference lies between this option and the other one.

Limitations of the Compressed File Attribute

The NTFS file system is the only Windows file system that supports compressed files. This means that partitions formatted in the FAT file system can not use file compression.

Some hard drives can be formatted to use cluster sizes larger than the default 4 KB size (more on this here). Any file system that's using a cluster size larger than this default size will be unable to use the features of the compressed file attribute.

Multiple files can not be compressed at the same time unless they're contained in a folder and then you choose the option to compress the contents of the folder. Otherwise, when selecting single files at a time (e.g. highlighting two or more image files), the option to enable the compression attribute will not be available.

Some files in Windows will cause problems if they're compressed because they're necessary for Windows to start up. BOOTMGR and NTLDR are two examples of files that should not be compressed. Newer versions of Windows won't even let you compress these types of files.

More Information on File Compression

While it probably comes as no surprise, larger files will take longer to compress than smaller ones. If an entire volume of files is being compressed, it will likely take quite a while to finish, with the total time depending on the number of files in the volume, the size of the files, and the overall speed of the computer.

Some files do not compress very well at all, while others may compress down to 10% or less of their original size. This is because some files are already compressed to some degree even before using the Windows compression tool.

One example of this can be seen if you try to compress an ISO file. Most ISO files are compressed when they're first built, so compressing them again using Windows compression will likely not do much of anything to the total file size.

When viewing the properties of a file, there's a file size listed for the actual size of the file (just called Size) and another listed for how large the file is on the hard drive (Size on disk).

The first number will not change regardless of whether or not a file is compressed because it's telling you the true, uncompressed size of the file. The second number, however, is how much space the file is taking up on the hard drive right now. So if the file is compressed, the number next to Size on disk will of course usually be smaller than the other number.

Compressing files may increase fragmentation on a volume. Because of this, defrag tools may take longer to defragment a hard drive that contains lots of compressed files.

Windows compresses files using the LZNT1 compression algorithm.

More From Us