Diving as a lifestyle has evolved on multiple occasions when air-breathing terrestrial animals invaded the aquatic realm, and diving performance shapes the ecology and behaviour of all air-breathing aquatic taxa, from small insects to great whales. Using the largest dataset yet assembled, we show that maximum dive duration increases predictably with body mass in both ectotherms and endotherms. Compared to endotherms, ectotherms can remain submerged for longer, but the mass scaling relationship for dive duration is much steeper in endotherms than in ectotherms. These differences in diving allometry can be fully explained by inherent differences between the two groups in their metabolic rate and how metabolism scales with body mass and temperature. Therefore, we suggest that similar constraints on oxygen storage and usage have shaped the evolutionary ecology of diving in all air-breathing animals, irrespective of their evolutionary history and metabolic mode. The steeper scaling relationship between body mass and dive duration in endotherms not only helps explain why the largest extant vertebrate divers are endothermic rather than ectothermic, but also fits well with the emerging consensus that large extinct tetrapod divers (e.g. plesiosaurs, ichthyosaurs and mosasaurs) were endothermic.