Animals generate neural representations of their heading direction. Notably, in insects, heading direction is topographically represented by the activity of neurons in the central complex. Although head direction cells have been found in vertebrates, the connectivity that endows them with their properties is unknown. Using volumetric lightsheet imaging, we find a topographical representation of heading direction in a neuronal network in the zebrafish anterior hindbrain, where a sinusoidal bump of activity rotates following directional swims of the fish and is otherwise stable over many seconds. Electron microscopy reconstructions show that, although the cell bodies are located in a dorsal region, these neurons arborize in the interpeduncular nucleus, where reciprocal inhibitory connectivity stabilizes the ring attractor network that encodes heading. These neurons resemble those found in the fly central complex, showing that similar circuit architecture principles may underlie the representation of heading direction across the animal kingdom and paving the way to an unprecedented mechanistic understanding of these networks in vertebrates.