Belief systems play a crucial role when it comes to guiding human information processing, evaluation, judgement, behavior, and social coordination. But why do individuals and groups adopt the specific ideologies they do? And is it possible to use the tools of economics to understand the decisions that are made in the market for ideology? To address these and related questions, we synthesize insights garnered from standard rational choice models, characteristics demand theory, and the distance theory of voting, as well as theory and research on "elective affinities" in psychology. We offer a formal analysis of the role of psychological and consumption needs in shaping the individual's choice of ideology under circumstances of uncertainty and limited resources and other constraints, including informational costs associated with learning about the potential match values of specific ideologies. After providing a few examples, we mention one non-obvious implication of our model, namely that people can be "wrong" about their own ideological preferences according to the criteria of rational consistency and utility maximization. The Market for Ideology 2 If you wish to strive for peace of soul and happiness, then believe; if you wish to be a disciple of truth, then inquire. (Friedrich Nietzsche, letter to his sister) Socially shared beliefs, including political and religious systems of thought, play a meaningful, if not decisive, role in the lives of most individuals (Jost, 2006). According to the Pew Research Center, three-fourths of Americans endorse some religious creed, and 45% report relying on those beliefs to make major life decisions (Pew, 2016). More than half of the believers worry that their belief systems are losing influence in America, and roughly 40% perceive conflict between their own beliefs and mainstream culture (Pew, 2020a). Even atheists and agnostics may hold "New Age" beliefsincluding beliefs in astrology, reincarnation, spiritual energy, and psychic phenomena (Pew, 2018). With respect to politics, ideological worldviews affect voting behavior and other forms of participation (Jost, in press). In recent years, for example, they have inspired millions around the globe to join demonstrations on the left in support of the natural environment and against institutionalized racism-as well as demonstrations on the right against immigrants and Muslims. All over the world, many subscribe to conspiracy theories, such as the belief that "the coronavirus outbreak was intentionally planned by powerful people" (Pew, 2020b). According to Ernest Gellner (1959), ideology "manifests itself simultaneously as a set of ideas or doctrines, a set of practices, and a more or less closely organized, more or less institutionalized social group. The ideas form a reasonably connected system, related in part by mutual entailment such that if key ideas are understood, the others follow" (pp. 231-232). An ideology, then, is a network of attitudes and beliefs, the elements of which are linked together logically and/or psychologic...