Flow is a subjective state characterized by immersion and engagement in oneโs current activity. The benefits of flow for productivity and health are well-documented, but a rigorous description of the flow-generating process remains elusive. Here we develop and empirically test a theory of flowโs computational substrates: the informational theory of flow. Our theory draws on the concept of mutual information, a fundamental quantity in information theory that quantifies the strength of association between two variables. We propose that the mutual information between desired end states and means of attaining them โ ๐ผ(๐;๐ธ) โ gives rise to flow. We support our theory across five experiments (four preregistered) by showing, across multiple activities, that increasing ๐ผ(๐;๐ธ) increases flow and has important downstream benefits, including enhanced attention and enjoyment. We rule out alternative constructs including alternative metrics of associative strength, psychological constructs previously shown to predict flow, and various forms of instrumental value.