The dentate gyrus (DG), in addition to its role in learning and memory, is increasingly implicated in the pathophysiology of anxiety disorders. Here, we show that, dependent on their position along the dorsoventral axis of the hippocampus, DG granule cells (GCs) control specific features of anxiety and contextual learning. Using optogenetic techniques to either elevate or decrease GC activity, we demonstrate that GCs in the dorsal DG control exploratory drive and encoding, not retrieval, of contextual fear memories. In contrast, elevating the activity of GCs in the ventral DG has no effect on contextual learning but powerfully suppresses innate anxiety. These results suggest that strategies aimed at modulating the excitability of the ventral DG may be beneficial for the treatment of anxiety disorders.