ZipToolView zip files online — 100% private

Lossless compression: byte-for-byte reconstruction

Lossless compression is any method whose decompressed output is identical to the original input, byte for byte. Nothing is thrown away; the compressor only finds a more compact way to represent the exact same information, and the decoder reconstructs it perfectly. This is the opposite of lossy compression, which deliberately discards some detail to reach much smaller sizes.

Every archive format — ZIP, RAR, 7z, tar.gz — is lossless. That is non-negotiable for files where a single changed bit breaks them: source code, executables, databases, documents, and (recursively) other archives. You can prove a lossless round trip with a checksum: ZIP stores a CRC-32 per entry precisely so an extractor can confirm the decompressed bytes match the original.

Lossless vs lossy

The distinction is whether information is discarded. Lossless compressors (ZIP, gzip, FLAC for audio, PNG for images, ALAC) exploit statistical redundancy — repeated patterns, uneven symbol frequencies — without losing any data. They undo exactly what they did. Lossy compressors (JPEG, MP3, AAC, MP4 video) model human perception and throw away detail the eye or ear is unlikely to miss, achieving ratios lossless methods cannot approach.

The ratios are not even close. A raw image might compress losslessly to 50-70% of its size; the same image as a JPEG can reach 5-10% and still look acceptable to a human. The catch is that the JPEG is no longer the original — repeated save/open cycles degrade it further, and you can never get the discarded detail back. For a photograph on a web page that is a fine trade. For a database backup or an executable, it is unthinkable.

Why archives are always lossless

An archive’s job is to faithfully preserve a set of files so they can be recovered exactly later. That demands losslessness: a source file with one byte changed will not compile, an executable will crash or behave wrong, a database row with a flipped bit is silently corrupt. So every format in the archive family — DEFLATE-based ZIP, LZMA-based 7z, gzip-compressed tarballs, RAR — is lossless by definition. The compression ratio they reach is bounded by the redundancy in the data, which is why text compresses well and media does not.

This is also why integrity checking is built in. ZIP’s per-entry CRC-32 lets an extractor detect if the decompressed data matches the original; a mismatch signals corruption, not a "lossy" approximation. There is no acceptable "close enough" in lossless archiving.

Why you cannot re-compress already-compressed data

A direct consequence follows: once data has been losslessly compressed, it has little redundancy left, so compressing it again does almost nothing. Re-zipping a .zip gains essentially nothing — and lossily-compressed media is even worse, because JPEG, MP3, and MP4 output already looks near-random to a lossless compressor (its entropy is already high). That is the Store method case: archives typically store such entries verbatim rather than waste CPU trying to shrink the unshrinkable.

This also explains the ceiling on lossless ratios. Text, code, JSON, and logs compress dramatically because they are highly repetitive. Binary media is already entropy-coded and resists further lossless compression. No lossless algorithm, however clever, can beat the Shannon entropy of the input — there is simply no redundancy left to remove.

How lossless compressors get their ratio

Lossless methods reach their ratio by combining two kinds of technique: dictionary/stage matching (finding and replacing repeated sequences, as in LZ77) and entropy coding (giving common symbols short codes, as in Huffman coding). DEFLATE chains exactly those two. More aggressive designs add larger dictionaries, range/arithmetic coding, and context modeling — that is the path from DEFLATE to LZMA to zstd — but they never cross into lossy territory. The bar is always the same: the output, decompressed, equals the input.

Frequently asked questions

What is lossless compression?

Lossless compression is any method whose decompressed output is identical to the original input, byte for byte. It finds a more compact representation of the exact same information without discarding anything, so the original can be perfectly reconstructed. Every archive format (ZIP, RAR, 7z, tar.gz) and formats like PNG, FLAC, and ALAC are lossless.

What is the difference between lossless and lossy compression?

Lossless compression discards no information and reconstructs the input exactly; lossy compression models human perception and throws away detail to reach much smaller sizes. A JPEG or MP3 is lossy and no longer identical to the original; a ZIP or PNG is lossless. Lossy achieves far higher ratios but cannot be reversed and degrades with repeated recompression.

Are ZIP files lossless?

Yes. ZIP, like every archive format, is lossless — its job is to preserve files exactly so they can be recovered bit-for-bit. Its default method DEFLATE combines LZ77 (replacing repeated byte sequences with back-references) and Huffman coding (short codes for common symbols), neither of which discards information. ZIP also stores a CRC-32 per entry so an extractor can verify the round trip.

Why does re-zipping a file not make it smaller?

Because compression removes redundancy, and already-compressed data has little redundancy left. Re-compressing a ZIP, or losslessly compressing a JPEG or MP3, finds almost nothing to remove and may even grow the output slightly from overhead. Archives typically store already-compressed entries verbatim (the Store method) rather than waste the effort.

How can I verify a file was compressed losslessly?

Compare a checksum of the original against the extracted file. ZIP stores a CRC-32 for each entry, computed over the uncompressed data; on extraction the tool recomputes it and flags any mismatch as corruption. A matching CRC means the bytes survived the round trip intact — the defining property of lossless compression.