sodcalculator

10 Tech How-To

Compress Windows With One Command: Measure the Trade-Off

Guide 10-32239 · Updated · Step by step

This guide shows you how to compress the Windows operating system files using a single command, and how to measure the space savings versus the performance impact. You’ll use the built-in compact.exe tool, which applies NTFS compression to system files. This is useful for freeing up disk space on older or smaller drives, but it can slow down file access because the CPU must decompress data on the fly.

What You’ll Need

  • A Windows 10 or Windows 11 PC with an NTFS-formatted system drive (most are).
  • Administrator privileges to run the command.
  • At least 10–15 minutes of idle time; the process can take a while.
  • A way to measure performance before and after (optional but recommended).

Step-by-Step

  1. Back up important data. Although compression is generally safe, any system-level operation carries risk. Create a restore point (search “Create a restore point” in Start, select your drive, and click “Create”) or have a backup ready.
  2. Measure your current disk usage. Open File Explorer, right-click your system drive (usually C:), and select “Properties.” Note the used and free space. This gives you a baseline to compare after compression.
  3. Measure your current performance (optional but recommended). Run a simple benchmark like CrystalDiskMark (free) or use Windows’ built-in Performance Monitor. Record the read/write speeds and latency. You’ll run the same test after compression to see the difference.
  4. Open Command Prompt as Administrator. Click Start, type “cmd,” right-click “Command Prompt,” and select “Run as administrator.” Accept the UAC prompt.
  5. Run the compression command. In the Command Prompt window, type the following and press Enter:
    compact /compactos:always
    This command compresses all Windows system files, including the WinSxS folder, and marks them so they stay compressed. It’s the “one command” that does the whole job.
  6. Wait for the process to finish. The command will show progress and a summary. It can take from a few minutes to over an hour depending on your drive speed and how many files need compressing. Do not interrupt it.
  7. Verify the compression. After it finishes, run compact /compactos:query to confirm that the system is in “Always” mode. It should return a message like “Windows is in the Always mode.”
  8. Measure disk usage again. Go back to File Explorer, right-click the drive, and check Properties. Compare the used space with your baseline. The difference is your space savings.
  9. Measure performance again. Re-run the same benchmark you used in step 3. Compare read/write speeds and latency. The difference (usually slower) is your performance cost.
  10. Calculate the trade-off. Divide the space saved by the performance drop (e.g., “saved 15 GB, read speed dropped 20%”). This tells you if the trade-off is worth it for your use case.
  11. To undo the compression (if needed), run compact /compactos:never as administrator. This decompresses all system files back to their original state, but it will take as long as the compression did.

Common Mistakes

  • Not running as administrator. The command will fail with “Access denied” if you don’t have admin rights. Always right-click and select “Run as administrator.”
  • Interrupting the process. Closing the Command Prompt or shutting down mid-compression can leave files half-compressed, which may cause errors. Let it finish.
  • Compressing a drive that’s not NTFS. NTFS compression only works on NTFS volumes. If your drive is FAT32 or exFAT, the command will not work. Check the file system in Properties.
  • Expecting compression on all files. Some files (like already-compressed media or encrypted files) won’t shrink. Don’t be surprised if the savings are less than expected.
  • Forgetting to measure before. Without a baseline, you can’t know what you saved or lost. Always record disk space and performance first.

Tips

  • Use on HDDs, not SSDs (usually). On a traditional hard drive, compression can actually improve read speeds because the drive reads less data and the CPU decompression is faster than the mechanical seek time. On an SSD, the CPU overhead usually makes things slower, so only compress if you’re desperate for space.
  • Compress only when disk space is critical. If you have less than 10% free space, compression can help you avoid “low disk space” warnings. But if you have plenty of room, the performance hit isn’t worth it.
  • Monitor your system after compression. If you notice apps taking longer to open or games stuttering, consider reverting with compact /compactos:never.
  • Combine with other cleanup. Run Disk Cleanup or Storage Sense before compressing to remove temporary files. That way, you compress fewer files and get more relative savings.
  • Test with your most-used apps. If you’re a gamer or video editor, run a quick test on a game or project load time. That’s more relevant than a synthetic benchmark.

Troubleshooting

  • “Access denied” error. You’re not running as administrator. Close the Command Prompt, right-click it, and choose “Run as administrator.”
  • “The parameter is incorrect” error. This often means the drive isn’t NTFS or the command isn’t supported. Check the drive’s file system. If it’s not NTFS, you’ll need to convert it (which is a separate process) or skip compression.
  • System becomes very slow after compression. This is a sign the CPU is struggling to decompress on the fly. Run compact /compactos:never to revert. If the system is too slow to open Command Prompt, boot into Safe Mode and run it there.
  • The command seems stuck. It’s normal for it to take a long time, especially on large drives. Check if the disk activity light is blinking. If it’s been over an hour with no progress, you can try Ctrl+C to stop it, but be aware this may leave files partially compressed. Then run the command again.
  • Windows Update fails after compression. Some updates require uncompressed files. If you encounter update errors, revert compression and try again.
  • Disk space didn’t increase as much as expected. This can happen if many files were already compressed (like in the WinSxS folder) or if the drive is nearly full of media files that don’t compress well. Check the summary output of the command to see how many files were compressed.

Frequently Asked Questions

Is it safe to compress the entire Windows folder?

Generally yes, Microsoft designed compact /compactos:always for this purpose. It’s reversible, and Windows can still boot and update. However, any system-level operation carries some risk, so a backup is wise.

How much space will I save?

It varies. On a typical Windows 10/11 install, you might save 10–30% of the system files, which could be 5–20 GB. The exact amount depends on what’s installed and how many files are already compressed.

Will my games and apps run slower?

Possibly. Games and apps that read many small files or stream data will see a performance hit because the CPU must decompress data. Large sequential reads (like video files) may be less affected. Test with your most-used software to know for sure.

Can I compress only certain folders instead of the whole OS?

Yes, you can right-click any folder in File Explorer, go to Properties > Advanced, and check “Compress contents to save disk space.” The compact command also supports targeting specific paths (e.g., compact /c C:\Windows\WinSxS).

How do I undo the compression?

Run compact /compactos:never as administrator. This will decompress all system files. It takes about as long as the compression did, so plan for some downtime.

Does compression affect Windows Update or security patches?

No, Windows Update works fine with compressed system files. However, if you ever see an update error, reverting compression is a good first troubleshooting step.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →