Sunscreen has changed the lives of beach bums everywhere, allowing them to laze longer in the sun without their skin baking into a ruddy crisp. And it’s most likely made them safer, protecting them from the ultraviolet radiation that causes nearly nine-tenths of cases of skin cancer.

But the same chemical compounds that are helping people live longer, sunnier lives are hurting the ocean. A new study published in Environmental Science & Technology found that when slathered-up beachgoers go for a dip, the traces of sunscreen that wash off into the ocean poison phytoplankton, the microscopic plant life that anchor the marine food web.

To conduct their study, scientists hit Palmira beach on Spain’s Majorca Island, which sits on a strip of the Mediterranean that attracts 200 million tourists a year. They found that by noon on hot August days, hydrogen peroxide concentrations in the seawater surged to nearly three times what they had been at dawn. Lab testing confirmed that under the glare of UV rays, particles of two common ingredients of sunscreen—titanium dioxide and zinc oxide—convert into hydrogen peroxide in similar volumes.

Here’s the problem: at those levels, hydrogen peroxide is so toxic to phytoplankton that it caused their numbers to crash by around 80%. These tiny single-cell plants function as the ocean’s salad bar, giving life to the entire marine ecosystem. Shrimp, for example, chow down on phytoplankton, and in turn become dinner for everything from squid and seals to penguins and whales.

Not only are phytoplankton a crucial part of a balanced ecosystem, they also perform a critical role in the Earth’s carbon cycle. Like land plants, phytoplankton get their energy by photosynthesis—swapping carbon dioxide in seawater for oxygen. This lets the sea absorb carbon dioxide from the atmosphere, stalling the effects of burning fossil fuels on air temperatures.