Lossless compression
Lossless compression encodes data so that decoding can reconstruct the original input exactly without discarding information.
Recovery: For byte-oriented formats such as DEFLATE and Zstandard, correct decoding reconstructs the input bytes. This guarantee applies to the encoder's input, not information discarded before encoding. Different valid encodings can recover the same input; recompression need not reproduce the same compressed bytes. [2] [1]
Space: No lossless compressor can make every possible input smaller. Framing and incompressible data can increase stored size; a codec label alone is not a capacity estimate. Filesystem allocation and metadata affect occupied storage, which is distinct from encoded-stream length. [1] [3]
Dependencies: A Zstandard frame may require an external dictionary even when its dictionary-ID field is absent. Retain the required dictionary and a compatible decoder alongside the compressed data. [2]
Counting bound: With one fixed decoder and fixed external context, 65,536 possible two-octet inputs compete for only 257 shorter octet strings (the empty string and 256 one-octet strings). At most 257 inputs can shorten; this is a counting bound, not a measured compression ratio. Per-object side information that varies with the input must be counted too. Shannon's source-coding result concerns average rates for a specified source, not guaranteed savings on each file. [1] [4]
Relations
- related
- Gorilla compression, Chimp compression, FPC, fpzip, zfp, Error-bounded lossy compression, Roaring bitmap, Transparent filesystem compression, Data-reduction ratio, Compression dictionary, DEFLATE, Zstandard, Asymmetric numeral systems, Compression ratio, Elias-Fano encoding, Golomb coding, Rice coding, Run-length encoding, Bit packing, Huffman coding, Delta encoding, Delta-of-delta encoding, Frame-of-reference encoding, Patched frame-of-reference, FSST, Burrows-Wheeler transform, Front coding, Grammar compression, Prediction by partial matching, Tunstall coding, Byte-pair encoding, Entropy coding, LZ78, LZW, LZ77, RubikFS
Advantages
- Byte-exact reconstruction supports compressing arbitrary file payloads without accepting deliberate information loss. [1, 2]
Limitations
- Reversibility does not prove that integrity checks were executed: Zstandard's content checksum is optional, and RFC 8878 permits decoders to ignore it. [2]
- Losslessness alone does not provide random access; DEFLATE and base Zstandard formats do not attempt to support it. [1, 2]
Citations
- RFC 1951: DEFLATE, sections 1.1, 1.3-1.4 and 4
- RFC 8878: Zstandard, sections 2, 3, 3.1.1 and 3.1.1.1.3
- Btrfs-progs v6.16: Compression, extent granularity and incompressible data
- Shannon (1948): A Mathematical Theory of Communication, sections 9-10; corrected reprint
Sources & caveats
- Source synthesis of general byte-preserving compression and format-specific examples; no measured compression ratio, speed or corruption rate is claimed.
- RFC 8878 is used for frame semantics, not as a statement of HTTP content-coding limits.