LZ4 Compression Visualizer

An interactive journey through LZ4 compression algorithm

Input Data

Algorithm Stats

Compression Ratio

-

Current Step

0/0

Size Comparison

Before
-
bytes
→
After
-
bytes
Saved
-

Visual Representation

Data Window

Match Analysis

Compression Output

What's happening now?

Press "Compress" to start the visualization.

LZ4 Algorithm Explained

LZ4 is a lossless data compression algorithm that is focused on compression and decompression speed. It belongs to the LZ77 family of byte-oriented compression schemes.

This visualization demonstrates the core concepts of LZ4 compression through a step-by-step walkthrough of how the algorithm processes data.

LZ4 works by:

  1. Finding Matches: The algorithm looks at previously seen data within a "window" to find sequences that match the current position.
  2. Encoding Matches: If a match is found that's at least 3 bytes long, it's encoded as a reference (offset, length) to save space.
  3. Encoding Literals: When no good matches are found, individual bytes are stored as literals.

This approach allows LZ4 to effectively compress repetitive data while maintaining extremely fast compression and decompression speeds.

Literal byte (directly stored)
Match (compressed reference)
Current position
Search window
Best match found