TOPICS
Search

Arithmetic Coding


Arithmetic coding is a lossless compression method that represents a message by a binary prefix whose numerical range lies inside an interval assigned to the message (Rissanen and Langdon 1979, Witten et al. 1987). Start with [0,1). In a fixed symbol order, partition the current interval into consecutive half-open subintervals whose lengths are proportional to the conditional probabilities of the next symbols given the message so far. Retain the subinterval for the actual symbol and repeat. The final interval I has length P, the product of those conditional probabilities.

A prefix of k bits representing the integer j specifies the interval [j/2^k,(j+1)/2^k) of numbers having that binary expansion prefix, using the terminating expansion at dyadic endpoints. For any message with P>0, an interval of this form fits inside I when k=[-log_2P]+1, where [x] is the ceiling function. Indeed, the mesh 2^(-k) is at most P/2, so rounding the left endpoint of I up to the next mesh point leaves room for a full mesh interval. This gives a description of fewer than -log_2P+2 bits.

With the same probability model, the decoder can use the left endpoint of the transmitted prefix interval to identify the chosen subinterval at each step. It stops after a known number of symbols or when it decodes a designated end symbol included in the model. 3Blue1Brown (2026) illustrates the successive subdivisions.


See also

Binary Expansion, Huffman Coding, Information Entropy, Prefix-Free Code

Explore with Wolfram|Alpha

References

3Blue1Brown. "How to Compress Text to 1 Bit per Character: Compression Is Intelligence Part 3." YouTube. Nov. 17, 2026. https://www.youtube.com/watch?v=qbsb9DpdZ6s.Rissanen, J. and Langdon, G. G. Jr. "Arithmetic Coding." IBM J. Res. Dev. 23, 149-162, 1979. https://doi.org/10.1147/rd.232.0149.Witten, I. H.; Neal, R. M.; and Cleary, J. G. "Arithmetic Coding for Data Compression." Commun. ACM 30, 520-540, 1987. https://doi.org/10.1145/214762.214771.

Cite this as:

Weisstein, Eric W. "Arithmetic Coding." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/ArithmeticCoding.html

Subject classifications