Why is my ZIP file bigger than the files inside it?
Haven Zip team · · 2 min read
You select a folder of holiday photos, create a ZIP, and the archive comes out a few kilobytes larger than the photos themselves. Nothing went wrong. Compression only works on data that has patterns left in it, and most of the files we handle today already had those patterns squeezed out by the program that made them.
Compression is pattern removal
Every general-purpose compressor, from the Deflate algorithm inside ZIP to LZMA inside 7z, does the same two things. It finds byte sequences that repeat and replaces the repeats with short back-references, and it gives frequent bytes shorter codes than rare ones. Text, spreadsheets, source code, log files and uncompressed bitmaps are full of repetition, so they shrink by 60 to 90 percent.
A JPEG photo, an MP4 video, an MP3 song or a PNG image has already been through a compressor designed specifically for that kind of data. What is left looks, to Deflate, like random noise. There are no repeats to find, so the compressor stores the bytes as they are and adds its own bookkeeping on top.
Where the extra bytes come from
A ZIP archive wraps each file in a local header and repeats the metadata in a central directory at the end. Per file that is roughly 60 to 100 bytes plus the file name twice. For a thousand photos that overhead alone is around 100 KB, which is why a ZIP of an already-compressed folder ends up slightly larger, never smaller.
The same is true for 7z and RAR, although 7z stores the directory in a compressed form and keeps the overhead smaller.
What to do instead
If the goal is a single file to send or store, use the store level (level 0) so the archiver does not waste time trying to compress the incompressible. Haven Zip exposes this as the compression level slider; level 0 is instant and produces the same size as level 9 for media.
If the goal is a smaller file, compress at the source. Export the photos at a lower JPEG quality, or transcode the video, and archive the results. Archivers cannot recover what the original encoder already threw away.
- Text, code, CSV, XML, JSON: high compression, use ZIP or 7z at level 5 or above.
- JPEG, PNG, MP4, MP3, PDF with images, DOCX: near zero gain, use level 0 or 1.
- Mixed folders: 7z with solid compression finds shared content across files and often beats ZIP.