Gastroliths or `stomach stones' occur frequently in some, but not all, groups of fossil and living marine tetrapods. Comparative analysis of gastrolith distribution suggests a role in buoyancy control rather than food processing. Once accidental ingestion by bottom-feeding animals is excluded, gastroliths occur in most tetrapods which `fly' underwater with hydrofoil limbs, including plesiosaurs, penguins, and otariid pinnipeds, but not the marine chelonians. They do not usually occur in cetaceans, ichthyosaurs, mosasaurs, and odobenid and phocid pinnipeds, which swim with a caudal fin or the equivalent. Occurrence in amphibious forms is variable; crocodilians often have gastroliths, but nothosaurs and placodonts do not. The correlation of gastroliths and underwater flight is corroborated by a comparative analysis which takes phylogenetic factors into account. There is no correlation with diet. Consideration of function and occurrence in terrestrial forms suggests that the use of gastroliths in digestion would not be useful, and might even be harmful, to a carnivorous marine tetrapod. Gastroliths are more efficient than skeletal bone (as in pachyostosis) in terms of sinking force per unit of added mass or volume. As well as driftwood and ice, marine tetrapods should be considered as a potential source of erratic stones in freshwater and marine sediments. Gastroliths may have evolved by the accidental ingestion of stones, the retention into adulthood of stones used by juveniles to process insect or plant food, or as a compensatory replacement for dense bones habitually filling the stomach. Their presence or absence should be more carefully recorded and further studies should be carried out on their function.