Dentate gyrus (DG) is widely thought to provide a teaching signal that enables hippocampal encoding of memories, but its role during retrieval is poorly understood. Some data and models suggest that DG plays no role in retrieval; others encourage the opposite conclusion. To resolve this controversy, we evaluated the effects of optogenetic inhibition of dorsal DG during context fear conditioning, recall, generalization, and extinction in male mice. We found that (1) inhibition during training impaired context fear acquisition; (2) inhibition during recall did not impair fear expression in the training context, unless mice had to distinguish between similar feared and neutral contexts; (3) inhibition increased generalization of fear to an unfamiliar context that was similar to a feared one and impaired fear expression in the conditioned context when it was similar to a neutral one; and (4) inhibition impaired fear extinction. These effects, as well as several seemingly contradictory published findings, could be reproduced by BACON (Bayesian Context Fear Algorithm), a physiologically realistic hippocampal model positing that acquisition and retrieval both involve coordinated activity in DG and CA3. Our findings thus suggest that DG contributes to retrieval and extinction, as well as to the initial establishment of context fear.SIGNIFICANCE STATEMENT Despite abundant evidence that the hippocampal dentate gyrus (DG) plays a critical role in memory, it remains unclear whether the role of DG relates to memory acquisition or retrieval. Using contextual fear conditioning and optogenetic inhibition, we show that DG contributes to both of these processes. Using computational simulations, we identify specific mechanisms through which the suppression of DG affects memory performance. Finally, we show that DG contributes to fear extinction learning, a process in which learned fear is attenuated through exposures to a fearful context in the absence of threat. Our data resolve a long-standing question about the role of DG in memory and provide insight into how disorders affecting DG, including aging, stress, and depression, influence cognitive processes.