What Is a Compressed File?

Data with the compressed attribute turned on is compressed to a smaller file size to save on hard drive space

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 we 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?

So, what does compressing a file actually do? 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 happen 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.

We 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, it might 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.

Compressing individual files is pretty easy in Windows thanks to the compressed attribute, but using a third-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 and Folders in Windows

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

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.

Like you see below, compressing a folder from File Explorer gives you two options: Apply changes to this folder only and Apply changes to this folder, subfolders and files.

Confirm Attribute Changes dialog box when compressing a folder in Windows 11

The first option for applying the changes to the one folder you're in will set up 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.

When compressing the C drive, or any other hard drive, you're given the same options as when compressing a folder, but the steps are a tad different. Open the drive's properties in File Explorer and tick the box next to Compress this drive to save disk space. You're then given the option to apply the compression to the root of the drive only or all of its subfolders and files, too.

Compressing to the ZIP Format

Something else you can do in Windows is compress files to a ZIP archive. The process outlined through that link will show you how to "zip a file," or in other words: put files and/or folders into an archive with the ZIP file extension.

Compressing your data to a ZIP file is different from turning on the compressed attribute. You'll instead get a file you can share over email or copy to a different hard drive, and it will retain its compression the whole time.

Making a ZIP file does not affect the original data. This is unlike when you use the compressed file attribute.

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 in our What Is a Sector? article). 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 percent 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).

Folder properties showing size on disk

The first number will not change regardless of whether 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.

Copying a file to a different hard drive will clear the compression attribute. For example, if a video file on your primary hard drive is compressed, but then you copy it to an external hard drive, the file will no longer be compressed on that new drive unless you manually compress it again.

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.

  • What file extension is used to name a compressed folder?

    Compressed files generally end with the .zip extension. Alternatives include .7z, which is used with the 7-Zip file extractor application, and .rar.

  • How do you unzip a compressed file?

    In Windows, locate the compressed file in File Explorer, right-click and select Extract All, then follow the directions. To unzip a compressed file on a Mac, simply open it. It will automatically decompress and put the uncompressed files in the same folder.

  • What image file type has already been compressed?

    JPEGs are image files that are compressed to significantly reduce their size, making them more sharable. The compression lowers image quality somewhat, but you can generally choose how compressed you want the JPEG to be, at the cost of more storage space.

  • What are the various compressed file formats for music files?

    Some common lossless compressed audio formats include FLAC, WavPack, Monkey's Audio, and ALAC. Lossy compressed audio formats include MP3 and AAC.

Was this page helpful?