ZIP archiving versus compression: why some files get bigger
ZIP can package files without compressing them. Repetitive data may shrink dramatically, but data with little redundancy can grow because of encoding and archive overhead. Compare the extracted bytes rather than assuming a smaller archive has lower quality.
Published: · Updated:
Separate the container from the codec
An archive records entries, filenames and other metadata. A compression method changes how each entry is represented. ZIP supports storing bytes without compression and several compressed methods, including DEFLATE. Even an archive with stored entries takes extra bytes for headers and its directory.
Understand why content matters
DEFLATE can encode repeated sequences compactly. Synthetic random-looking bytes provide fewer repeated patterns and may expand slightly. Already compressed images, videos or archives often offer little opportunity for a second compressor; exact savings depend on the file and encoder.
Compare the measured archives
In the original lab, two 16384-byte files were packaged using STORE and DEFLATE level 6. The STORE archive is 32992 bytes; the DEFLATE archive is 16651 bytes. The repeating member shrinks to 38 compressed bytes, while the synthetic binary member grows to 16389 bytes. Both extract to identical inputs.
Choose an archive method safely
Use compression when it saves worthwhile transfer or storage space; storing already compressed files can avoid wasted processing. When opening unfamiliar archives, inspect entries, sizes and destination paths before extraction. A successful integrity check is not a security scan, and untrusted archives may exhaust available disk space.
Compare STORE and DEFLATE
- Record the byte lengths of learn-zip-stored.zip and learn-zip-deflated.zip without changing either file.
- Extract each into a separate empty folder using a ZIP reader that supports DEFLATE.
- Compare the extracted file lengths and SHA-256 values against the lab report for repeated.txt and synthetic.bin.
- Calculate the full archive size difference separately from the compressed member sizes; the archive includes headers.
Both archives reconstruct 32768 original bytes. Archive lengths are 32992 and 16651 bytes; the smaller archive is not a lossy version of the larger one.
Independent laboratory results
Test date:
Both archives reconstruct 32768 original bytes. Archive lengths are 32992 and 16651 bytes; the smaller archive is not a lossy version of the larger one.
- Uncompressed ZIP (STORE)
learn-zip-stored.zip - Compressed ZIP (DEFLATE)
learn-zip-deflated.zip - Measured sizes and hashes (JSON)
learn-zip-measured-results.json
STORE: 32992 B; DEFLATE: 16651 Brepeated.txt: 16384 B → 38 Bsynthetic.bin: 16384 B → 16389 BSHA-256(STORE extracted) = SHA-256(DEFLATE extracted)
Independent check: Python zipfile / Node.js zlib / SHA-256