Explore modules

Arithmetic Coding

Encode a sequence of symbols as a single nested rational interval within [0, 1).

Free theory article

Encode a sequence of symbols as a single nested rational interval within [0, 1).

Concept & interpretation

Instead of replacing each symbol with a fixed prefix code like Huffman coding,arithmetic coding represents an entire sequence of symbols as a single real number within the interval [0, 1). As the message grows longer, the interval grows smaller. Any number within that final bounded interval can be decoded to reconstruct the original message, provided the decoder knows the message length and the exact same probability model.

Interactive Experiment

You can test the previous derivation in the Arithmetic Coding module.

  1. Ensure the Message input is AB.
  2. Verify the Model is set to 2,1,1 (default).
  3. Click Step to encode 'A'. The interval [0, 1/2) appears.
  4. Click Finish to encode 'B'. The interval [1/4, 3/8) appears.
  5. The results panel displays the final interval [1/4, 3/8), width 1/8, and the exact rational midpoint 5/16. Click Reset to rewind without changing Message or Model.
Read the full free theory article