File compression shrinks the size of a file by removing redundancy and unused space
When you compress a file, software looks for patterns and repetition in the data — places where the same information appears multiple times or where space is wasted. It then rewrites the file in a more efficient way, using fewer bytes to store the same content. A photo, document, or video file that takes up 100 MB might compress down to 30 MB or smaller, depending on what type of file it is and how much repetition it contains.
The compressed file is useless until you decompress it — extract it back to its original form. Most operating systems now handle this automatically: on Windows you can right-click a .zip file and choose "Extract All"; on Mac you double-click a .zip file and it opens. The original file reappears, identical to what you started with.
Compression matters because smaller files move faster over the internet, take up less storage space on your device, and are easier to attach to emails. A folder full of documents that would normally be too large to email can fit in a single compressed archive that arrives in seconds instead of minutes.
Key Takeaways
- Compression rewrites files to use less space by removing redundancy, making them faster to send and easier to store.
- You must decompress (extract) a compressed file before you can use it — the original file is rebuilt when you do.
- Different file types compress by different amounts: text and documents compress heavily, while photos and videos compress very little because they are already optimized.
- The two most common compression formats are .zip (works on Windows, Mac, and Linux) and .rar (requires separate software to open on most systems).
How compression actually works
Compression software uses algorithms — step-by-step instructions — to find and eliminate waste. The simplest approach is run-length encoding: if a file contains the same byte repeated 50 times in a row, the software stores "byte X, repeat 50 times" instead of writing it out 50 times. That saves space immediately.
More sophisticated algorithms look for patterns across the entire file. If the word "the" appears 1,000 times in a document, the software might replace every instance with a single symbol, then store a key that says "symbol 7 means the". When you decompress, the software reads the key and puts "the" back everywhere the symbol appears. The file shrinks because one symbol takes less space than three letters repeated 1,000 times.
There are two types of compression: lossless and lossy. Lossless compression removes no information — when you decompress, you get back exactly what you started with, byte for byte. Lossy compression throws away information that humans usually do not notice: a photo might lose some color detail, or an audio file might lose frequencies your ear cannot hear. Lossy compression achieves much smaller file sizes but you cannot recover what was discarded.
Which file types compress well and which do not
Text files, spreadsheets, and word documents compress extremely well — often to 10 percent of their original size or smaller. These files contain a lot of repetition: the same words, spaces, and formatting codes appear over and over. Compression finds and eliminates that redundancy easily.
Photos and videos compress poorly with lossless compression because they are already optimized. A JPEG photo file is already compressed using lossy algorithms; compressing it again with a .zip tool might shrink it by 5 to 10 percent at most. An MP4 video is the same — the video codec has already removed redundancy and discarded information humans do not perceive. Zipping it again wastes your time for almost no gain.
Executable programs (.exe files on Windows, .app files on Mac) fall in the middle. They contain some repetitive code but also a lot of unique data. A compressed program might be 30 to 50 percent smaller, but you must decompress it before you can run it — you cannot execute a program while it is still in a .zip file.
The difference between .zip, .rar, and other formats
.zip is the standard across Windows, Mac, and Linux. Every modern operating system can open a .zip file without installing anything extra. When you right-click a folder on Windows and choose "Send to > Compressed (zipped) folder", you are creating a .zip file. On Mac, right-clicking and choosing "Compress" does the same thing. .zip uses lossless compression and can hold multiple files and folders inside a single archive.
.rar is a competing format that sometimes compresses files slightly smaller than .zip, but it requires you to install separate software like WinRAR or 7-Zip to open it. .rar is less common for everyday use but you may encounter it when downloading software or large files from certain websites.
Other formats exist — .7z, .tar, .gz — but they are less common on consumer devices. .tar and .gz are standard on Linux and Mac for software distribution. .7z offers very strong compression but requires 7-Zip software. For most everyday tasks, .zip is the right choice because it works everywhere without extra software.
When compression helps and when it does not
Compression is useful when you are sending files over the internet, especially email. A folder containing 20 Word documents might be 50 MB uncompressed; zipped, it becomes 5 MB and arrives in seconds instead of timing out or hitting attachment limits. Compression is also useful when you are archiving files you do not use often — storing them compressed saves disk space.
Compression does not help when you are moving files between devices on a fast local network, or when the files are already compressed (photos, videos, music). Decompressing takes time and processor power; if your network is fast enough, that time is wasted. Similarly, if you are storing a single large video file, compressing it will not save meaningful space and will only slow down the moment you need to watch it.
Compression also does not help with security. A compressed file is not encrypted — anyone who gets the .zip file can see what is inside. If you need to send sensitive documents, compression alone is not enough; you need encryption, which scrambles the contents so only someone with the right password can read them.
How to compress and decompress files on your device
On Windows: Right-click the file or folder you want to compress. Choose "Send to > Compressed (zipped) folder". Windows creates a new .zip file in the same location with the same name plus ".zip". To decompress, right-click the .zip file and choose "Extract All", then pick where to put the extracted files.
On Mac: Right-click the file or folder and choose "Compress". Mac creates a .zip file automatically. To decompress, double-click the .zip file and it extracts in the same location. You can also drag files into the Archive Utility application if you prefer.
On Linux: Right-click and choose "Compress" or use the command line: zip -r filename.zip foldername to compress, or unzip filename.zip to decompress. Different Linux distributions have different graphical tools, but the command line works everywhere.
Frequently Asked Questions
Can I edit a file inside a compressed archive without extracting it first?
Some programs let you open files directly from a .zip archive, but changes you make are not automatically saved back to the archive. You must extract the file, edit it, and then re-compress it if you want the changes in the archive. It is simpler to extract first, edit, and compress again when you are done.
What happens if a compressed file gets corrupted during download?
A corrupted .zip file may not decompress at all, or it may decompress partially with missing or damaged files inside. Some compression software can attempt to recover data from a damaged archive, but there is no may provide. Always verify that a downloaded file matches the checksum or hash provided by the source — a mismatch means the download was corrupted.
Is a password-protected .zip file secure?
Password protection on a .zip file prevents someone from seeing what is inside, but it is not strong encryption. Modern computers can crack simple passwords quickly. For truly sensitive documents, use encryption software like VeraCrypt or BitLocker instead of relying on .zip password protection.
Why does my compressed file seem almost as large as the original?
This happens when you compress files that are already compressed — photos, videos, and music files. These formats use lossy compression algorithms that have already removed redundancy. Compressing them again finds almost nothing to remove, so the .zip file is barely smaller. Compression works best on text, documents, and uncompressed data.