Repository logo

zlib compression library

Change log


Gailly, Jean-loup 
Adler, Mark 


zlib 1.2.1 is a general purpose data compression library written in the C programming language. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).

These documents are also available in the DSpace@Cambridge "DSpace" community, in the "RFCs" collection.

All functions of the compression library are documented in the file zlib.h (volunteer to write man pages welcome, contact A usage example of the library is given in the file example.c which also tests that the library is working correctly. Another example is given in the file minigzip.c. The compression library itself is composed of all source files except example.c and minigzip.c.


(taken from on 2004-12-01)

zlib is designed to be a free, general-purpose, legally unencumbered -- that is, not covered by any patents -- lossless data-compression library for use on virtually any computer hardware and operating system. The zlib data format is itself portable across platforms. Unlike the LZW compression method used in Unix compress(1) and in the GIF image format, the compression method currently used in zlib essentially never expands the data. (LZW can double or triple the file size in extreme cases.) zlib's memory footprint is also independent of the input data and can be reduced, if necessary, at some cost in compression. A more precise, technical discussion of both points is available on another page.

zlib was written by Jean-loup Gailly (compression) and Mark Adler (decompression). Jean-loup is also the primary author/maintainer of gzip(1), the author of the comp.compression FAQ list and the former maintainer of Info-ZIP's Zip; Mark is also the author of gzip's and UnZip's main decompression routines and was the original author of Zip. Not surprisingly, the compression algorithm used in zlib is essentially the same as that in gzip and Zip, namely, the `deflate' method that originated in PKWARE's PKZIP 2.x.

Greg, Mark and/or Jean-loup will add some more stuff here when they think of something to add. For now this page is mainly a pointer to zlib itself and to the official zlib and deflate documentation. Note that the specifications both achieved official Internet RFC status in May 1996, and zlib itself was adopted by JavaSoft in version 1.1 of the Java Development Kit (JDK), both as a raw class and as a component of the JAR archive format.

See also:


zlib, gz, compression, deflate, zip, jar

Is Part Of


Publisher DOI

Publisher URL