Terrestrial animals with rigid shells face imminent danger when turned upside down. A rich variety of righting strategies of beetle and turtle species have been described, but the exact role of the shell's geometry in righting is so far unknown. These strategies are often based on active mechanisms, e.g. most beetles selfright via motion of their legs or wings; flat, aquatic turtles use their muscular neck to flip back. On the other hand, highly domed, terrestrial turtles with short limbs and necks have virtually no active control: here shape itself may serve as a fundamental tool. Based on field data gathered on a broad spectrum of aquatic and terrestrial turtle species we develop a geometric model of the shell. Inspired by recent mathematical results, we demonstrate that a simple mechanical classification of the model is closely linked to the animals' righting strategy. Specifically, we show that the exact geometry of highly domed terrestrial species is close to optimal for self-righting, and the shell's shape is the predominant factor of their ability to flip back. Our study illustrates how evolution solved a far-from-trivial geometrical problem and equipped some turtles with monostatic shells: beautiful forms, which rarely appear in nature otherwise.