Skip to content
Main menu
  • Main page
  • Discover
  • Unexpected connections
  • Topics
  • Random article
  • Search
Your library
  • Saved articles
  • Recent discoveries
  • Rabbit-hole trails
Topic areas
  • Computer Science
  • Mathematics
  • Physics
  • Engineering
  • Biology
  • Economics
  • Curiosities
WikiholeDeeper into Wikipedia
EnglishEN
  • Saved
  • History

  • Article text and media come live from Wikipedia via the official MediaWiki API and are available under the Creative Commons Attribution-ShareAlike 4.0 License; additional terms may apply. Each article links to its source and revision.
  • WikiHole is an independent project and is not affiliated with the Wikimedia Foundation.
  • How ranking works
  • All topics
  • Reading history
  • Random article
  • MediaWiki API

LZ4 (compression algorithm)

  • Article
  • Rabbit hole
  • Read
  • View history
Tools
Actions
  • Read
  • View history
General
  • Recent changes
  • Related articles
  • Random discovery
This article
Reading time
3 min
Topic
Computer Science
Quality
Start-class
Views
961 in 14 days
Last edited
27 Oct 2026
Print/export
  • Printable version
In other projects
  • Wikidata item
From Wikipedia, the free encyclopedia
Rabbit hole:
  1. LZ4 (compression algorithm)
LZ4 (compression algorithm)
Original authorYann Collet
DeveloperYann Collet
Release24 April 2011 (2011-04-24)
Stable release1.11.11 / 10 November 2026 (10 November 2026)
Written inC
Operating systemCross-platform
PlatformPortable
TypeData compression
LicenseSimplified BSD License
Websitelz4.org
Repositorygithub.com/lz4/lz4

LZ4 is a lossless data compression algorithm optimized for fast compression and decompression. It belongs to the family of byte-oriented compression schemes.

LZ77

Loading the rest of the article…

Recent changes

Rabbit hole

Where LZ4 (compression algorithm) leads. Every connection below has a source: a link in this article, a shared Wikipedia category, or CirrusSearch text similarity. Articles already on your trail are left out.

Contents
  • (Top)
  • Features
  • Design
  • Implementation
  • References
  • External links
  • Recent changes
  • Rabbit hole
Contents
Contents7 sections
  • (Top)
  • Features
  • Design
  • Implementation
  • References
  • External links
  • Recent changes
  • Rabbit hole
Study aids for LZ4 (compression algorithm)

Terminology

LZ4
LZ4 is a lossless data compression algorithm optimized for fast compression and decompression.

Terms the article defines in bold, quoted in context.

Categories:
  • Lossless compression algorithms
  • Free data compression software
  • C (programming language) libraries
  • Data compression

476 words · 17 references · revision 1382175610 · CC BY-SA 4.0

General
  • Recent changes
  • Related articles
  • Random discovery
This article
Reading time
3 min
Topic
Computer Science
Quality
Start-class
Views
961 in 14 days
Last edited
27 Oct 2026

Key concepts

  • Lossless data compression1
  • Algorithm1
  • LZ771
  • Lempel–Ziv–Oberhumer1
  • DEFLATE1
  • Zstd2
  • Entropy encoding1
  • Huffman coding1
  • Initramfs1
  • C (programming language)1

The articles this one links to most, weighted towards the introduction.

Print/export
  • Printable version
In other projects
  • Wikidata item

Features

The LZ4 algorithm provides a good trade-off between speed and compression ratio. Typically, it has a smaller (i.e., worse) compression ratio than the similar LZO algorithm, which in turn is worse than algorithms like DEFLATE. However, LZ4 compression speed is similar to LZO and several times faster than DEFLATE, while decompression speed is significantly faster than LZO.3

Design

LZ4 only uses a dictionary-matching stage (LZ77) and, unlike other common compression algorithms, does not combine it with an entropy coding stage (e.g. Huffman coding in DEFLATE).45

The LZ4 algorithm represents the data as a series of sequences. Each sequence begins with a one-byte token that is broken into two 4-bit fields. The first field represents the number of literal bytes that are to be copied to the output. The second field represents the number of bytes to copy from the already decoded output buffer (with 0 representing the minimum match length of 4 bytes). A value of 15 in either of the bitfields indicates that the length is larger and there is an extra byte of data that is to be added to the length. A value of 255 in these extra bytes indicates that yet another byte is to be added. Hence, arbitrary lengths are represented by a series of extra bytes containing the value 255. The string of literals comes after the token and any extra bytes needed to indicate string length. This is followed by an offset that indicates how far back in the output buffer to begin copying. The extra bytes (if any) of the match-length come at the end of the sequence.67

Compression can be carried out in a stream or in blocks. Higher compression ratios can be achieved by investing more effort in finding the best matches. This results in both a smaller output and faster decompression.

LZ4 has two frame formats. The legacy format was very restrictive and relied on an external end-of-file signal, which proved to be a problem in Linux initramfs requiring a workaround to handle zero-padding.8 The new format is a lot more flexible and has its own end-of-frame marker. It resembles the Zstd frame format in design.9

Implementation

The reference implementation in C by Yann Collet is licensed under a BSD license. There are ports and bindings in various languages including Java, C#, Rust, and Python.10 The Apache Hadoop system uses this algorithm for fast compression. LZ4 was also implemented natively in the Linux kernel 3.11.11 The FreeBSD, Illumos, ZFS on Linux, and ZFS-OSX implementations of the ZFS filesystem support the LZ4 algorithm for on-the-fly compression.12131415 Linux supports LZ4 for SquashFS since 3.19-rc1.16 LZ4 is also supported by the newer zstd command line utility by Yann Collet, as well as a 7-Zip fork called 7-Zip-zstd.17

References

  1. 1"Release LZ4 v1.11.0 · lz4/lz4". Retrieved 5 November 2026.
  2. 2Collet, Yann. "LZ4 Frame Format Description". GitHub. Retrieved 7 October 2020.
  3. 3Michael Larabel (28 January 2013). "Support For Compressing The Linux Kernel With LZ4". Phoronix. Retrieved 28 August 2015.
  4. 4Collet, Yann (30 March 2019). "LZ4 Block Format Description". GitHub. Retrieved 9 July 2020. “There is no entropy encoder back-end nor framing layer.”
  5. 5DEFLATE Compressed Data Format Specification version 1.3. IETF. doi:10.17487/RFC1951. RFC . Retrieved 9 July 2020.

External links

  • Official website
1951
  • 6Yann Collet (26 May 2011). "RealTime Data Compression". Retrieved 28 August 2015.
  • 7ticki (25 October 2016). "How LZ4 works". Retrieved 29 June 2017.
  • 8"lz4/doc/lz4_Frame_format.md at dev · lz4/lz4". GitHub.
  • 9"LZ4 Frame Format Description".
  • 10Extremely Fast Compression algorithm http://www.lz4.org on GitHub
  • 11Jonathan Corbet (19 July 2013). "Kernel development". LWN.net. Retrieved 28 August 2015.
  • 12"FreeBSD 9.2-RELEASE Release Notes". FreeBSD. 13 November 2013. Retrieved 28 August 2015.
  • 13"LZ4 Compression". illumos. Archived from the original on 9 October 2018. Retrieved 28 August 2015.
  • 14Illumos #3035 LZ4 compression support in ZFS and GRUB on GitHub
  • 15"Features: lz4 compression". OpenZFS. Retrieved 28 August 2015.
  • 16Phillip Lougher (27 November 2014). "Squashfs: Add LZ4 compression configuration option". Retrieved 28 August 2015.
  • 177-zip-zstd
  • Created
    19 Jul 2013
    History
    138 edits
    93 contributors
    1 edit in the last 30 days
    Last edited
    27 Oct 2026

    138 revisions in total · 93 contributors · +4 / 0 bytes across 1 edits by 1 contributor in the last 30 days

    1. 27 Oct 2026, 02:19 UTCX spager§ Implementation+4diff
    2. 16 Feb 2026, 18:34 UTCAcylglycerophosphoethanolaminetypo0diff
    3. 16 Feb 2026, 09:55 UTCAcylglycerophosphoethanolaminewording: magic number+1diff
    4. 16 Feb 2026, 09:50 UTCAcylglycerophosphoethanolaminewording−6diff
    5. 14 Jan 2026, 22:50 UTCJengelhmadd missing commas+2diff
    6. 14 Jan 2026, 22:48 UTCJengelhtrim filler wording−7diff
    7. 21 Jul 2025, 03:46 UTCArtoria2e5~+43diff
    8. 21 Jul 2025, 03:44 UTCArtoria2e5§ Design ~+631diff

    View full revision history

    Created
    19 Jul 2013
    History
    138 edits
    93 contributors
    1 edit in the last 30 days
    Last edited
    27 Oct 2026

    Go deeper: linked from this article

    • Linked from the introduction

      Lossless compression

      Data compression approach allowing perfect reconstruction of the original data

      Lossless compression is a class of data compression that allows the original data to be perfectly reconstructed from the compressed data with no loss of information.

      13 min readGo deeper
    • Linked from the introduction

      Algorithm

      Sequence of operations for a task

      In mathematics and computer science, an algorithm is a finite sequence of mathematically rigorous instructions, typically used to solve a class of specific problems or to perform a computation.

      25 min readGo deeper
    • Linked from the introduction

      LZ77 and LZ78

      Lossless data compression algorithms

      LZ77 and LZ78 are the two lossless data compression algorithms published in papers by Abraham Lempel and Jacob Ziv in 1977 and 1978.

      7 min readGo deeper

    Adjacent: shared categories and similar text

    • Shares category “C (programming language) libraries”

      Zstd

      Lossless compression algorithm

      Zstandard is a lossless data compression algorithm developed by Yann Collet at Facebook. Zstd is the corresponding reference implementation in C, released as open-source software on 31 August 2016.

      9 min readGo deeper
    • Shares category “Data compression”

      Huffman coding

      Technique to compress data

      In computer science and information theory, a Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression.

      13 min readGo deeper
    • Linked in “Implementation”

      Apache Hadoop

      Distributed data processing framework

      Apache Hadoop is a collection of open-source software utilities for reliable, scalable, distributed computing.

      18 min readGo deeper
    • Shares category “C (programming language) libraries”

      C (programming language)

      General-purpose programming language

      C is a general-purpose programming language created in 1972 by Dennis Ritchie.

      38 min readGo deeper
    • Linked in “Implementation”

      Rust (programming language)

      General-purpose programming language

      Rust is a general-purpose programming language that emphasizes performance, type safety, concurrency, and memory safety. Rust supports multiple programming paradigms.

      44 min readGo deeper
    • Linked in “Implementation”

      Python (programming language)

      General-purpose programming language

      Python is a high-level, general-purpose programming language that emphasizes code readability, simplicity, and ease-of-writing with the use of significant indentation, an extensive ("batteries-included") standard library, and garbage collection.

      53 min readGo deeper
    • Linked in “Implementation”

      C Sharp (programming language)

      General-purpose programming language

      C# (see SHARP) is a general-purpose high-level programming language supporting multiple paradigms.

      38 min readGo deeper
    • Shares category “Data compression”

      Deflate

      Lossless compression algorithm

      In computing, Deflate (stylized as DEFLATE) is a lossless data compression algorithm that uses a combination of LZ77 and Huffman coding.

      11 min readGo deeper
    • Linked in “Implementation”

      ZFS

      Copy-on-write file system

      ZFS (previously Zettabyte File System, now an orphaned initialism) is a file system with volume management capabilities. It began as part of the Sun Microsystems Solaris operating system in 2001.

      39 min readGo deeper
    • Shares category “Data compression”

      Entropy coding

      Lossless data compression scheme

      In information theory, an entropy coding (or entropy encoding) is any lossless data compression method that attempts to approach the lower bound declared by Shannon's source coding theorem, which…

      3 min readGo deeper
    • Linked in “Implementation”

      Linux kernel

      Free Unix-like operating system kernel

      The Linux kernel is a free and open-source Unix-like kernel that is used in many computer systems worldwide.

      78 min readGo deeper