libdeflate-gzip is a great alternative to Zopfli

A 6 months ago I blogged about my use of Zopfli to get better file compression for this website.

Yesterday I was slacking on GitHub and saw that Zopfli’s repository got archived on October 14, 2025. It’s unsurprising that Google would stop development on this project, with the Brotli format being the hot new lossless compression format for the web: gzip is becoming irrelevant. I’m sticking with Gzip for my personal website. OpenBSD hasn’t packaged the Nginx brotli module, so I am stuck with gzip for now.

The end of the Zopfli maintenance got me wondering: Are there good alternatives? It turns out that yes there is libdeflate, it has a gzip compressor: libdeflate-gzip.

How do the two compare? They are close in terms of compression ratio. I compressed this website’s Atom feed and its search index for comparison, here are the compression ratios:

atom.xmlsearch_index.en.js
gzip -92.788.53
zopfli2.919.13
libdeflate-gzip -122.899.11

libdeflate-gzip compression is almost as good as Zopfli.

Beyond comparable compression ratios, libdeflate-gzip offers a significant advantage: speed. To quantify it, I benchmarked all three tools using hyperfine.

For atom.xml:

Benchmark 1: zopfli -c atom.xml > /dev/null
  Time (mean ± σ):     106.7 ms ±   0.4 ms    [User: 104.2 ms, System: 2.2 ms]
  Range (min … max):   106.3 ms … 108.2 ms    28 runs

Benchmark 2: gzip -9 < atom.xml > /dev/null
  Time (mean ± σ):       2.3 ms ±   0.0 ms    [User: 2.0 ms, System: 0.4 ms]
  Range (min … max):     2.3 ms …   2.4 ms    1107 runs

Benchmark 3: libdeflate-gzip -12 -k -c atom.xml > /dev/null
  Time (mean ± σ):       6.1 ms ±   0.1 ms    [User: 5.2 ms, System: 0.8 ms]
  Range (min … max):     6.0 ms …   6.6 ms    462 runs

Summary
  gzip -9 < atom.xml > /dev/null ran
    2.63 ± 0.04 times faster than libdeflate-gzip -12 -k -c atom.xml > /dev/null
   46.17 ± 0.45 times faster than zopfli -c atom.xml > /dev/null

For search_index.en.js:

Benchmark 1: zopfli -c search_index.en.js > /dev/null
  Time (mean ± σ):      5.378 s ±  0.006 s    [User: 5.331 s, System: 0.029 s]
  Range (min … max):    5.370 s …  5.391 s    10 runs

Benchmark 2: gzip -9 < search_index.en.js > /dev/null
  Time (mean ± σ):      65.3 ms ±   0.1 ms    [User: 64.4 ms, System: 0.7 ms]
  Range (min … max):    65.1 ms …  65.6 ms    45 runs

Benchmark 3: libdeflate-gzip -12 -k -c search_index.en.js > /dev/null
  Time (mean ± σ):     534.6 ms ±   0.7 ms    [User: 528.0 ms, System: 4.6 ms]
  Range (min … max):   533.8 ms … 535.9 ms    10 runs

Summary
  gzip -9 < search_index.en.js > /dev/null ran
    8.19 ± 0.02 times faster than libdeflate-gzip -12 -k -c search_index...
   82.35 ± 0.14 times faster than zopfli -c search_index.en.js > /dev/null

While libdeflate-gzip is significantly slower than gzip, it is more than 10 times faster than zopfli.

With libdeflate-gzip delivering 95% of Zopfli’s compression gains at 10× the speed—all while being actively maintained—the choice was clear. I replaced Zopfli with libdeflate for my workflow. If you’re still using Zopfli for static asset compression, libdeflate-gzip deserves your attention.