The first time I came face to face with a sea lion, I nearly screamed. I was snorkeling, and after a long time spent staring down at colorful corals, I looked up to see a gigantic bull, a couple of feet in front of my mask. Its eyes were opalescent. Its long canines hinted at its close evolutionary ties to land-based predators like bears and dogs. And most unnervingly of all, it was huge.

Mammals tend to get that way when they invade the ocean. The pinnipeds—seals, sea lions, and walruses—tend to be immense blobs of muscle and blubber. The same could be said for manatees and dugongs. And whales are almost synonymous with bigness. Time and again, lineages of furry mammals have gone for a swim and over evolutionary time, they’ve ballooned in size. Why?

Most of the explanations for this trend treat the ocean as a kind of release. The water partly frees mammalian bodies from the yoke of gravity, allowing them to evolve heavy bodies that they couldn’t possibly support on land. The water unshackles them from the constraints of territory, giving them massive areas over which to forage. The water liberates them from the slim pickings of a land-based diet and offer them vast swarms of plankton, crustaceans, and fish to gorge upon.

But William Gearty from Stanford University has a very different explanation. To him, the ocean makes mammals big not because it relieves them of limits, but because it imposes new ones.

“As you enter the water, you start to lose heat from your body that you aren’t losing on land or air,” he explains. To counteract that constant loss of heat, humans use wet suits, whales have blubber, and otters have thick fur. “But really the easiest way to counteract it is to get bigger,” Gearty says. As bodies balloon, volume increases faster than surface area does, so you produce more heat in your body but lose comparatively less of it from your skin. But animals can’t become infinitely big because larger bodies also demand more fuel. There’s only so much food that an animal can reasonably find, catch, and swallow.

So, the need to stay warm sets a floor for the body size of oceanic mammals, while the need to eat sets a ceiling. And the gap between them, Gearty found, is surprisingly narrow—and far more so than on land.

Together with Jonathan Payne, also from Stanford, and Craig McClain from the Louisiana Universities Marine Consortium, Gearty collected data on the sizes of almost 7,000 mammal species, both living and extinct. He showed that the marine groups—whales, manatees, and seals—have all independently hit an average optimum mass of around 1,100 pounds.

There’s obviously a lot of variation around that—a sperm whale is clearly not the same size as a dolphin. But crucially, that variation is much lower in the sea than it is on land. “The minimum size in these aquatic groups is thousands of times larger than the minimum for terrestrial groups, but the maximum size is only 25 times larger,” says Gearty. “I found it strange that no one had noticed before.”

These trends aren’t consistent with the idea of the ocean as a release. Instead, it suggests that the water imposes strict constraints. To thrive in it, mammals must be just the right size—big, yes, but not too big and not too small. And Gearty could calculate the boundaries of this Golidlocks zone with a set of equations that connect a mammal’s size with the heat it loses to the water and the rate at which it can find food. These equations predicted both the optimum 1,100-pound average that seagoing mammals have evolved toward, and the narrow range of sizes around that ideal.

That makes sense, says Samantha Price from Clemson University, who studies mammal evolution. “But evolution is complex,” she says, “and energetic trade-offs may not have driven the evolution of large size in complete isolation.” It’s possible that the other proposed factors, like increased buoyancy, made it easier for marine mammals to hit that Goldilocks zone, by reducing the costs of being larger.

And as always in biology, there are exceptions. Sea otters, for example, are unusually small for marine mammals—they’re about as big as a Labrador. That might be because their extremely thick fur, with up to a million hairs per square inch, allows them to stay warm without being big. They also spend a lot of time on land, where heat loss is less of a problem.

At the other extreme, the baleen whales go way beyond the 1,100-pound optimum. The biggest of them, the blue whale, can reach up to 400,000 pounds. It and its truly gargantuan relatives only emerged in the last few million years of whale evolution, and Nick Pyenson from the Smithsonian Institution thinks he knows why. Around 3 million years ago, a combination of changes to glaciers, winds, and currents created large surges of nutrients in coastal waters, which then fed hordes of crustaceans and small fish—potential prey for whales. But as I wrote last year:

These bonanzas weren’t evenly distributed. They were concentrated in particular, far-flung places—all-you-can-eat buffets separated by literal food deserts. And that, Pyenson says, is why the giant baleen whales evolved. They are beautifully adapted to hunt down sparse but concentrated prey. Their huge size allows them to survive for long stretches without encountering any food. And they evolved a foraging technique called lunge feeding, where they accelerate into a shoal of prey, open their ballooning mouths, and suck in vast volumes of water.

The emergence of concentrated prey, and the evolution of a technique for capturing them, allowed whales to smash through the diet-imposed ceiling that keeps other marine mammals big, but not too big. That's why they, rather than manatees or seals, transformed from big animals into the biggest animals that ever existed.