Coffee simply does not like to stay in place. Restaurant servers soon learn to pour coffee at the table or to carry the poured cup and saucer separately, lest they wind up with a half-empty coffee cup sitting in a pool of spilled liquid.

Beer, however, presents no such challenge. Servers can maneuver through crowds while carrying a fully-loaded tray of beers fresh from the tap and filled to the top—all without spilling so much as a drop.

Both coffee and beer are liquids, however, so why is one of those beverages so much more prone to sloshing over the edge of its cup or glass than the other?

Curious physicists have now identified the answer—it all comes down to foam.

Just as solid foam reduces noise by absorbing sound waves, liquid foam does the same for motion. The researchers discovered foam's insulating effects by performing controlled lab experiments on coffee and beer. They used high speed cameras to record the waves of motion that rocked through the surface of coffee, an amber beer and Guinness. The more foam that was present, they observed, the more energy was absorbed and the less sloshing occurred.

While the researchers found that just a few layers of bubbles were enough to make a difference for slosh, not all beers were equal in their spillage reduction. Once the foam is more than about five bubbles thick, the researchers found, the motion on the foam and liquid's surface becomes more horizontal than vertical. In other words, the thicker the head of foam, the less likely a spill will occur. So when it comes to preventing sloshing, the researchers concluded, Guinness reigns supreme.