Close your eyes and conjure up your paradise vacation: umbrellaed drink in hand, trashy detective novel perched on your knee, the rhythmic swell of waves in your ears, and of course – the fresh, briny smell of the sea.

That poetic smell comes, in part, from a not-so-poetically-named sulfur compound called dimethyl sulfide, or DMS, a key player in ocean ecosystems and weather patterns. Now, scientists from the Weizmann Institute of Science in Israel have figured out how a particular ocean algae – one that dwells in the upper sunlit part of the sea – makes the aromatic chemical.

Scientists have long known that this type of algae, a single-celled phytoplankton by the name of Emiliania huxleyi, produces the odorous compound, but they didn’t know how. In a paper published last Thursday in Science, though, researchers identified the enzyme the algae uses to make the compound, and the genes that encode that enzyme, called Alma1. They also found similar genes in other ocean organisms – which suggests that many more organisms than they previously knew produce this sulfur compound.

The group confirmed their enzyme identification by putting the protein’s gene in E. coli, which doesn’t naturally create the aromatic sulfur compound. They got the confirmation they wanted – the E. coli made the stinky DMS. “It’s a gold standard of proof that it catalyzes this reaction,” says Tom Hanson, a professor of marine bioscience at the University of Delaware unaffiliated with the research. “So they really nailed it,” he says. “It’s an example of how to couple next generation sequencing and biochemistry, to pin reactions on enzymes in a really elegant way.”

The Alma1 enzyme, aside from building the molecule that gives the beach its special stink, turns out to be crucial to the ocean’s health. The global ecosystem relies on a delicate balance of sulfur-containing chemical reactions, converting one compound to the other, collectively called the sulfur cycle. Similar to the carbon cycle, in which plants process the carbon dioxide that animals produce, different organisms consume and produce sulfur compounds that make life possible – over land and sea.

Aromatic DMS is made from another chemical that algae use as protection from the saltiness of its ocean home. Without this precursor chemical, water would rush out of the poor phytoplankton, leading to its salty death. The algae convert some of this protective chemical into the smelly stuff that reaches our noses, releasing it into the water when they die.

If the algae died thanks to a viral infection, other phytoplankton will pick up on that chemical release and interpret it as a warning, arming themselves against infection. “It’s like a signal for the algae to say to their buddies in the water column, better protect yourself from the virus,” says Hanson. The algae also are a basic food source for ocean organisms such as small fish, and the smell lets schools know their next meal is nearby. Even seabirds are attracted to the smell, which alert them to the small fish in the water. “When organisms learn that there’s DMS, it’s a signal for ‘Oh, there’s food here,’” Hanson says.

After a while, the sulfurous algae emissions escape into the atmosphere, where beachgoers get the benefit of its lovely smell. That slow seep is actually the most abundant source of biological sulfur in the atmosphere – sulfur that helps with cloud formation. Scientists think that it plays a major role in controlling the planet’s temperature. “If these reactions didn’t exist, we would have a much different planet, and it wouldn’t be habitable,” says Hanson. “We rely on these microorganisms catalyzing these particular reactions as part of their metabolism for us to be able to live.”

So that characteristic smell of the sea breeze? It’s how the creatures of the ocean, from the tiny plankton to the seabirds, converse with each other, ultimately making your beach vacation possible.