whatisgithub

What is zlib?

madler/zlib — explained in plain English

Analysis updated 2026-06-24

6,857CAudience · developerComplexity · 3/5LicenseSetup · moderate

In one sentence

A foundational C library for compressing and decompressing data, used inside operating systems, browsers, and databases worldwide. It implements the gzip and deflate formats defined in open internet standards.

Mindmap

mindmap
  root((zlib))
    What it does
      Data compression
      Decompression
      Gzip support
    Formats
      deflate RFC 1951
      zlib RFC 1950
      gzip RFC 1952
    Integration
      C API via zlib.h
      Unix configure make
      Windows builds
    Audience
      C developers
      Systems programmers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add gzip compression to a C or C++ application by linking against zlib and calling its compress and decompress functions.

USE CASE 2

Read and write .gz files in your program using zlib gzip-format support.

USE CASE 3

Implement deflate-format stream compression in a network protocol or file format following open RFC standards.

What is it built with?

C

How does it compare?

madler/zlibphilipl/pifshathach/tinyusb
Stars6,8576,8976,796
LanguageCCC
Setup difficultymoderatehardmoderate
Complexity3/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Builds with standard configure and make on Unix, Windows requires a separate build configuration included in the source.

Use freely in any software including commercial products, you do not need to include an attribution notice in your end product.

So what is it?

zlib is a data compression library written in C. It has been in continuous use since 1995 and is one of the most widely distributed pieces of software in existence, built into operating systems, web browsers, file archivers, databases, and countless other programs. When software needs to make files smaller for storage or transmission, zlib is often the library doing that work behind the scenes. The library implements a compression format called deflate, which is also the basis of the gzip format used for .gz files and the zlib envelope format. These formats are defined in public internet standards documents (RFCs 1950, 1951, and 1952) rather than being proprietary, so data compressed with zlib can be read by any conforming implementation. zlib is designed to be used by developers as a component in their own software. It provides functions for compressing and decompressing data and is documented through a header file called zlib.h. The library comes with example programs and a test suite. It builds on most Unix-like systems with a standard configure and make process, and the source includes additional build configurations for Windows and other platforms. The library is thread-safe with some caveats noted in the FAQ. It does not include any third-party code and has been written entirely by Jean-loup Gailly and Mark Adler. Language interfaces exist for Python, Java, Perl, and Tcl, though those are maintained separately. zlib is free to use in any software, including commercial products, under a permissive license that does not require the usual open-source attribution to be included in the end product. The library's home page and FAQ are at zlib.net.

Copy-paste prompts

Prompt 1
How do I add zlib to my C project with CMake and use it to compress a buffer of bytes in memory?
Prompt 2
Show me a minimal C example that reads a .gz file and decompresses it to stdout using zlib.
Prompt 3
I am implementing HTTP compression in a C server. Which zlib functions handle deflate-format streams?
Prompt 4
How do I build zlib from source on Linux and link it statically into my C application?

Frequently asked questions

What is zlib?

A foundational C library for compressing and decompressing data, used inside operating systems, browsers, and databases worldwide. It implements the gzip and deflate formats defined in open internet standards.

What language is zlib written in?

Mainly C. The stack also includes C.

What license does zlib use?

Use freely in any software including commercial products, you do not need to include an attribution notice in your end product.

How hard is zlib to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is zlib for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.