When a container is set in motion, the free surface of the liquid starts to oscillate or slosh. Such effects can be observed when a glass of water is handled carelessly and the fluid sloshes or even spills over the rims of the container. However, beer does not slosh as readily as water, which suggests that foam could be used to damp sloshing. In this work, we study experimentally the effect on sloshing of a liquid foam placed on top of a liquid bath. We generate a monodisperse two-dimensional liquid foam in a rectangular container and track the motion of the foam. The influence of the foam on the sloshing dynamics is experimentally characterized: only a few layers of bubbles are sufficient to significantly damp the oscillations. We rationalize our experimental findings with a model that describes the foam contribution to the damping coefficient through viscous dissipation on the walls of the container. Then we extend our study to confined three-dimensional liquid foam and observe that the behavior of 2D and confined 3D systems are very similar. Thus we conclude that only the bubbles close to the walls have a significant impact on the dissipation of energy. The possibility to damp liquid sloshing using foam is promising in numerous industrial applications such as the transport of liquefied gas in tankers or for propellants in rocket engines.