We propose and study a new information transmission problem motivated by today’s internet. A real number, perhaps representing control information in a network, is encoded using Bernoulli trials. This differs from the traditional framework of Shannon’s information theory (by having no codewords) as well as from parameter estimation in mathematical statistics (by allowing users to vary the encoding). Choice of the best encoding reduces to a problem in the calculus of variations, which we solve rigorously. In particular, we show there is a unique optimal encoding. Our tools come mainly from real analysis and measure-theoretic probability, but there is also a connection to classical mechanics. Generalizations to higher dimensional cases are open.