LZ4 is a lossless compression algorithm, providing compression speed > 500 MB/s per core (>0.15 Bytes/cycle).
It features an extremely fast decoder, with speed in multiple GB/s per core (~1 Byte/cycle). A high compression derivative, called LZ4_HC, is available, trading customizable CPU time for compression ratio.
LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding. There is no entropy encoder back-end nor framing layer. The latter is assumed to be handled by other parts of the system (see LZ4 Frame format). This design is assumed to favor simplicity and speed. It helps later on for optimizations, compactness, and features.
LZ4 is also compatible with dictionary compression, both at API and CLI levels. It can ingest any input file as dictionary, though only the final 64KB are used. This capability can be combined with the Zstandard Dictionary Builder, in order to drastically improve compression performance on small files.
Compression can be done in: a single step (described as Simple Functions), a single step, reusing a context (described in Advanced Functions), and unbounded multiple steps (described as Streaming compression).
LZ4 library is provided as open source software using a BSD license.
Website: lz4.github.io/lz4
Support: GitHub Code Repository
Developer: Yann Collet
License: BSD 2-Clause license
LZ4 is written in C. Learn C with our recommended free books and free tutorials.
Related Software
| Compression Tools | |
|---|---|
| LZ4 | Focused on compression and decompression speed |
| Zstandard | Fast compression algorithm, providing high compression ratios |
| brotli | Generic-purpose lossless compression algorithm |
| lzop | File compressor favoring speed over compression ratio |
| pigz | Parallel implementation of gzip |
| ouch | CLI tool for compressing and decompressing for various formats |
| pixz | Parallel, indexed xz compressor |
| gzip | Provides the standard GNU file compression utilities |
| BZip3 | Spiritual successor to BZip2 |
| bzip2 | Freely available, patent free, high-quality data compressor |
| PBZIP2 | Parallel implementation of bzip2 |
| lrzip | Achieve very high compression ratios and speed when used with large files |
| lbzip2 | Multi-threaded implementation of bzip2, suited for serial and parallel processing |
| ZXC | High-performance lossless compression library and command-line tool |
| plzip | Massively parallel lossless data compressor |
| p7zip-zstd | p7zip fork with additional codecs and improvements |
| 7-Zip | File archiver with a high compression ratio |
| ncompress | Fast, simple LZW file compressor |
| PXZ | Runs LZMA compression on multiple cores and processors |
| crabz | Like pigz but written in Rust |
| Lzip | Lossless data compressor aimed at Unix-like systems |
| cmix | Optimize compression ratio at the cost of high CPU/memory usage |
| lrzip-next | Long Range ZIP |
| rapidgzip | Parallelized decompression of gzip files |
| igzip | Command-line compression and decompression utility |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

