LZ4 is a lossless compression algorithm delivered as a C library and a separate command-line tool. It targets high compression and decompression throughput on multicore systems.
Overview
LZ4 is a lossless compression algorithm aimed at very high speed. The reference implementation provides a library for embedding compression in applications and a command-line program for pipelines and file work. Compression throughput can be tuned with an acceleration factor that trades ratio for speed, and a higher-compression variant called LZ4HC is available when more CPU time is acceptable.
The library exposes block, high-compression, and frame APIs documented in its headers. Long streams use multiple blocks organized into a frame format so interoperable tools can exchange data. Dictionary compression is supported at both API and CLI levels, with optional pairing to external dictionary-building tools for small inputs.
Benchmarks published with the project compare LZ4 against other compressors on a standard corpus on Linux. The same site discusses pipeline benchmarks where decompression keeps pace with limited storage or network links. Ports and bindings exist in many languages beyond the C reference, and distributions often ship both liblz4 and the lz4 CLI through package managers.
Downstream uses described publicly span operating-system storage, databases, messaging systems, backup tools, and file formats, reflecting a focus on paths where decode speed matters as much as compression.
Key features
- Very fast lossless compression
- Fast decompression at memory-like speeds
- LZ4HC higher-ratio mode
- Dictionary compression support
- Block and frame format APIs
- CLI for pipelines and files
- Acceleration factor speed tuning
- Broad language ports and bindings
Use cases
- Low-latency storage and filesystem compression
- Network and stream payload compression
- Database page or column compression
- Backup and log throughput
- Embedded or kernel image compression