A Massively Spiffy Yet Delicately Unobtrusive Compression Library
(Also Free, Not to Mention Unencumbered by Patents)
(Not Related to the Linux zlibc Compressing File-I/O Library)
Welcome to the zlib home page, web pages originally created by
Greg Roelofs
and maintained by Mark Adler.
If this page seems suspiciously similar to the
PNG Home Page, rest assured
that the similarity is completely coincidental. No, really.
zlib was written by
Jean-loup Gailly (compression) and
Mark Adler
(decompression).
Current release:
zlib 1.2.7
May 2, 2012
Version 1.2.7 has many portability improvements over 1.2.6, and has these enhancements:
- Fix bug in gzclose_w() when gzwrite() fails to allocate memory
- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen()
- Add gzopen_w() in Windows for wide character path names
- Fix type mismatch between get_crc_table() and crc_table
You can also look at the complete Change Log.
Version 1.2.6 has many changes over 1.2.5, including these improvements:
- gzread() can now read a file that is being written concurrently
- gzgetc() is now a macro for increased speed
- Added a 'T' option to gzopen() for transparent writing (no compression)
- Added deflatePending() to return the amount of pending output
- Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode
- deflatePrime() can now insert bits in the middle of the stream
- ./configure now creates a configure.log file with all of the results
- Added a ./configure --solo option to compile zlib with no dependency on any libraries
- Fixed a problem with large file support macros
- Fixed a bug in contrib/puff
- Many portability improvements
Version 1.2.5 fixes bugs in gzseek() and gzeof() that were present in version 1.2.4 (March 2010). All users are encouraged to upgrade immediately.
Version 1.2.4 has many changes over 1.2.3, including these improvements:
- Fixed bugs in adler32_combine(), compressBound(), and deflateBound()
- Wholesale replacement of gz* functions with faster versions
- As part of that, added gzbuffer(), gzoffset(), gzclose_r(), and gzclose_w() functions
- Faster Z_HUFFMAN_ONLY and Z_RLE compression for images and other specialized compression
- Added flush options Z_BLOCK to deflate() and Z_TREES to inflate() for finer control
- Added inflateReset2() and inflateMark() functions, the latter to aid in random access applications
- Added LFS (Large File Summit) support for 64-bit file offsets and many other portability improvements
- Updated examples in examples/ and updated third-party contributions in contrib/
If you are using libxml version 2.7.6 or earlier, you will need to update libxml to version 2.7.7 or later before installing zlib version 1.2.4 or later. libxml 2.7.6 and earlier made unnecessary assumptions about the undocumented internal structure of zlib that were changed in zlib 1.2.4 and result in libxml crashing. This was fixed in libxml 2.7.7.
Version 1.2.3 (July 2005) eliminates potential security vulnerabilities
in zlib 1.2.1 and 1.2.2, so all users of those versions should upgrade immediately. The following important fixes
are provided in zlib 1.2.3 over 1.2.1 and 1.2.2:
- Eliminate a potential security vulnerability
when decoding invalid compressed data
- Eliminate a potential security vulnerability
when decoding specially crafted compressed data
- Fix a bug when decompressing dynamic blocks with no distance codes
- Fix crc check bug in gzread() after gzungetc()
- Do not return an error when using gzread() on an empty file
Versions 1.1.4 (March 2002) and later eliminate an earlier potential security vulnerability, see details here. Any software that is linked
against or derived from an earlier version of zlib should be upgraded
immediately.
A partial list of over 500 applications using zlib
is given here
(uncompressed).
-
Canonical URL:
http://zlib.net/ (US)
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.
Mark and Jean-loup can be reached by e-mail at
.
Please read the FAQ and
the manual before asking
us for help. We are getting too many questions which already have an
answer in the zlib documentation.
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 related links. Note
that the deflate and zlib specifications both achieved official Internet RFC status in May 1996,
and zlib itself was adopted in version 1.1 of the Java Development Kit (JDK), both as a
raw class and as a component of the JAR archive
format.
The lovely zlib-vise image above was provided courtesy of Bruce Gardner, art
director of Dr. Dobb's Journal. It
appears in Mark Nelson's article in the January 1997 issue (see below).
The current release is publicly available here:
-
zlib source code, version 1.2.7, tar.gz format (547K,
MD5 checksum 60df6a37c56e7c1366cca812414f7b85):
-
US (zlib.net)
-
Pick a mirror (prdownloads.sourceforge.net)
-
zlib source code, version 1.2.7, tar.bz2 format (493K,
MD5 checksum 2ab442d169156f34c379c968f3f482dd):
-
US (zlib.net)
-
Pick a mirror (prdownloads.sourceforge.net)
-
zlib source code, version 1.2.7, zipfile format (658K,
MD5 checksum 2e396ac9097054a19c147e9d1b3a85dd):
-
US (zlib.net)
-
Pick a mirror (prdownloads.sourceforge.net)
Note that zlib is an integral part of
libpng and
has been tested extensively as part of many
PNG-supporting
applications.
zlib Information
-
zlib Frequently Asked Questions
-
Zlib-announce mailing list
-
New versions of zlib are announced on this list.
-
Zlib-devel mailing list
-
Please do not send questions or comments about zlib to
this mailing list. Send those directly to the authors at
after checking the FAQ and
the manual, of course. The zlib-devel list is for the development of
zlib—members are contributors to and testers of new versions of zlib.
-
zlib Manual
-
zlib Usage Example
-
zlib Technical Details
-
zlib-related specifications:
-
zlib's Deflate Algorithm
-
zlib's deflate flush modes
-
zlib License
-
zlib on github
Related External Links
-
zlib for Linux, both shared and
static plus headers (RPM format, many
architectures)
-
zlib for Solaris
-
zlib for Solaris (alternate)
-
zlib for SCO Open Server 5.0
-
zlib for BeOS R5
-
zlib for Mac OS X: zlib is already included as part of Mac OS X
-
zlib for Mac OS
-
zlib for
OS/2 (DLL and static version for emx 0.9c, 46k)
-
(click here if link breaks)
-
zlib for Palm Pilot
-
zlib for Newton OS
-
zlib for Windows CE
-
zlib for RIM BlackBerry
-
zlib for Windows
9x/NT/2000/XP/2003 (DLL version, plus related utilities)
-
zlib for Windows 9x/NT (DLL and static version)
-
DotNetZip zip file manipulation for .NET, and more (including replacements for the
buggy Microsoft GZipStream and DeflateStream classes)
-
zlib for .NET in C#
-
zlib DLL wrapper for .NET in VB
-
Zip for .NET
-
Mark Nelson's
ZlibTool article and
Win32 source code for
Dr. Dobb's Journal (January 1997)
-
zlib C++ wrapper for the
gz*
functions.
-
C++ zlib and gzip filters in an iostream framework.
-
zlib
32-bit OCX
(C++ source and binaries for use with Visual Basic 4.x or
Delphi 2.0)
-
(unsupported VB5 binary also available)
-
zlib Pascal port (Pascal source, tested with Turbo
Pascal 7.0 and Delphi 3.02)
-
(not tested by us, but looks complete and well-maintained)
-
zlib Delphi 5 interface
-
(includes compiled object files and corresponding C++ Builder 5
project files)
-
zlib Perl interface (source code; look for Compress-Zlib*.tar.gz)
-
zlib Python
interface (online manual; part of the standard library as of
Python 1.5)
-
zlib Tcl
interface mkZiplib
-
zlib Haskell
interface
-
zlib Java interface (see also JAR format)
-
zlib reimplementation in pure
Java
-
(not tested by us, but looks like a good alternative to
java.util.zip)
-
Mark Nelson's
JavaZip article (with source code) for
Dr. Dobb's Journal (December 1997)
-
Random access for gzip archives, for Java
-
Gilles Vollant's zlib-based
mini-zip and
mini-unzip
-
(see also Info-ZIP's UnZip,
which optionally can be compiled with zlib)
-
Scott Ludwig's zlib-based
CExe executable compressor for Win32
-
zlib technical issues, including spec errors
-
zlib information in Japanese
-
zlib information in Russian
-
Real World Scanning and Halftones
(second edition includes a section on zlib)
-
Markus Oberhumer's
LZO `real-time' data compression library
-
(not tested by us, but looks like a good alternative if you need
more speed and less compression)
-
lz4, a very fast compression algorithm
-
(not tested by us, but looks like an even better alternative if you need
more speed and less compression)
-
libbzip2
-
(not tested by us, but looks like a good alternative if you need
more compression and less speed)
-
PPP Deflate Protocol
(RFC 1979)
-
Info-ZIP Home Page
-
Portable Network Graphics (PNG)
Home Page
-
gzip Home Page
-
pigz (parallel gzip) Home Page
-
DataCompression.info
-
comp.compression Frequently Asked Questions list
Send comments or questions about zlib to the authors at
after checking FAQ and
manual.
Please report broken links to
(PGP key).
Last updated July 13th, 2012.