The brain is thought to represent specific memories through the activity of sparse and distributed neural ensembles. In this review, we examine the use of immediate early genes (IEGs), genes that are induced by neural activity, to specifically identify and genetically modify neurons activated naturally by environmental experience. Recent studies using this approach have identified cellular and molecular changes specific to neurons activated during learning relative to their inactive neighbors. By using opto-and chemogenetic regulators of neural activity, the neurons naturally recruited during learning can be artificially reactivated to directly test their role in coding external information. In contextual fear conditioning, artificial reactivation of learning-induced neural ensembles in the hippocampus or neocortex can substitute for the context itself. That is, artificial stimulation of these neurons can apparently cause the animals to "think" they are in the context. This represents a powerful approach to testing the principles by which the brain codes for the external world and how these circuits are modified with learning.