In the hippocampus, environmental changes elicit rearrangement of active neuronal ensembles or remapping of place cells. However, it remains elusive how the brain ensures a consistent representation of a certain environment itself despite salient events occurring there. Here, we longitudinally tracked calcium dynamics of dorsal hippocampal CA1 neurons in mice subjected to contextual fear conditioning and extinction training. Overall population activities were significantly changed by fear conditioning and were responsive to footshocks and freezing. However, a small subset of neurons, termed environment cells, were consistently active in a specific environment irrespective of experiences. A decoder modeling study showed that these cells, but not place cells, were able to predict the environment to which the mouse was exposed. Environment cells might underlie the constancy of cognition for distinct environments across time and events. Additionally, our study highlights the functional heterogeneity of cells in the hippocampus.