Archive format

LZ4 converter

An .lz4 file is an LZ4-compressed stream. LZ4 optimises for one thing — speed — decompressing at gigabytes per second, near memory bandwidth, and accepting a modest compression ratio in exchange. It is used where the alternative is not another codec but no compression at all.

Private for supported formats — processed in your browser

Convert supported files

Runs on your device

Drop LZ4 files here

Batch files can each use a different output. Nothing uploads for local conversions.

Working inputs include camera RAW, browser-local audio/video, PDF, CBZ/CBR comics, office documents, ebooks, markup, 3D models, structured text, images, and archives.

Where LZ4 comes from

Yann Collet released LZ4 in 2011, before his later Zstandard, as a byte-oriented LZ77 variant with no entropy coding at all — that omission is what makes it so fast. It went into the Linux kernel for compressed swap and hibernation, into HDFS, Kafka and Redis, and became the default codec for many databases' write paths. The frame format was specified separately in 2015 so that streams could be self-describing rather than raw blocks.

How LZ4 works

  • The frame magic is 04 22 4D 18, followed by a descriptor recording block size, whether blocks are independent, and which checksums are present.
  • Each block is length-prefixed, and the high bit of that length means the block is stored uncompressed — which a producer sets when compression would have made the block larger.
  • Within a block, a token byte carries a literal length in its high nibble and a match length in its low nibble, each extended by 0xFF continuation bytes when the nibble is 15.
  • Matches are 2-byte little-endian back-references with a minimum length of 4, and they frequently overlap the bytes being written — an offset of 1 is how LZ4 encodes a run.
  • There is no entropy coding stage, so ratios are well behind Gzip; the point is that decompression is a copy loop.

When to use LZ4

  • Reading a database or message-queue payload compressed for speed rather than size
  • Unpacking a build cache or an intermediate artefact
  • Opening an .lz4 file without installing the reference tool
  • Rewriting the contents as ZIP or TAR.GZ for a recipient with ordinary tools

Strengths and limitations

Strengths

  • Decompression is fast enough that reading compressed data can beat reading uncompressed data from disk
  • A small, clearly specified format with a straightforward decoder
  • Permissively licensed (BSD) and implemented in every major language

Limitations

  • Compression ratios are clearly worse than Gzip, let alone Zstandard
  • Frames may declare linked blocks, which need a sliding window across block boundaries and are not universally supported
  • The bare block format and the frame format are both called LZ4, and files of one are not readable as the other

Compatibility

The reference `lz4` tool, 7-Zip, PeaZip and most language bindings read the frame format. Novus Convert decodes it in the browser with a frame reader written against the specification — the bundled libarchive build has no LZ4 support at all and would otherwise try to invoke an external program — and writes ZIP, TAR or TAR.GZ. Frames using linked blocks are refused rather than half-decoded.

LZ4 stores no file metadata; anything preserved comes from a TAR inside the stream.