Compression Demos

DeltaEncoding

Encodes values as differences from the previous value. Works best on sorted or slowly-changing data where differences are small numbers.

0 values
ENCODED OUTPUT
DECODED (RECONSTRUCTED)
0
Values
Max Delta
Avg Delta
Match

How to use this tool

  1. Type or paste a list of numbers into the input box — separate them with commas, spaces, or newlines. The delta encoding appears instantly in ENCODED OUTPUT.
  2. Load Sorted Example or Random Example to compare how differently the two datasets compress.
  3. The first value is kept as-is; every following value is stored as the difference from the previous one.
  4. Watch the stats — Values, Max Delta, Avg Delta, and Match summarize the sequence and confirm the round-trip.
  5. Hit Copy Encoded to grab the delta list, or Copy Decoded for the reconstructed values.
  6. Use Clear any time to reset the box and start over.

Why this tool is helpful

Time-series & sensor data

Counters, gauges, and timestamps change slowly, so consecutive differences stay small — the reason time-series databases like Prometheus and Gorilla use delta-of-delta encoding.

Sorted & monotonic sequences

Sorted lists, IDs, and offsets produce small, non-negative deltas that compress far better than the raw values they replace.

Learn how compressors work

Delta encoding is a common first step before variable-length or run-length coding. Small deltas are what make those later steps effective.

Prepare data for varint & zigzag

Pairing small deltas with variable-length integer encoding is a standard technique in binary protocols and columnar storage formats.

Verify lossless round-trips

The DECODED (RECONSTRUCTED) output rebuilds the original values, and the Match stat reads YES to confirm nothing was lost.

Stay private

Everything runs in your browser. Nothing is uploaded, logged, or sent to a server — safe for sensitive numeric data.

FAQ

What is delta encoding?

It stores the first value unchanged, then each following value as the difference from the one before it. For example, [10, 25, 40] becomes [10, 15, 15].

How does decoding reconstruct the original?

By cumulative sum: start with the first value, then keep adding each delta. 1010+15=2525+15=40.

Why is the first value kept as-is?

It acts as the anchor. Without a starting point, the list of differences can't be converted back into absolute values.

When does delta encoding not help?

On random or jumpy data the deltas can be as large as — or larger than — the original values, so there's little to gain. It shines on sorted or slowly-changing data.

Can I paste negative numbers or hex?

Yes. Negative numbers are handled, and hex bytes can be given with a 0x prefix (for example 0xFF). Values are separated by commas, spaces, or newlines.

Is delta encoding lossy?

No. The DECODED (RECONSTRUCTED) output always rebuilds the exact input, and the Match stat reads YES when the round-trip is perfect.

Does any of my data leave my browser?

Never. Encoding, decoding, and stats all run locally in JavaScript. Nothing is sent to, stored on, or logged by any server.