The popular bar prank known in colloquial English as beer tapping consists in hitting the top of a beer bottle with a solid object, usually another bottle, to trigger the foaming over of the former within a few seconds. Despite the trick being known for long time, to the best of our knowledge, the phenomenon still lacks scientific explanation. Although it seems natural to think that shock-induced cavitation enhances the diffusion of CO2 from the supersaturated bulk liquid into the bubbles by breaking them up, the subtle mechanism by which this happens remains unknown. Here we show that the overall foaming-over process can be divided into three stages where different physical phenomena take place in different time-scales, namely: bubble-collapse (or cavitation) stage, diffusion-driven stage and buoyancy-driven stage. In the bubble-collapse stage, the impact generates a train of expansion-compression waves in the liquid that leads to the fragmentation of pre-existing gas cavities. Upon bubble fragmentation, the sudden increase of the interface-area-to-volume ratio enhances mass transfer significantly, which makes the bubble volume grow by a large factor until CO2 is locally depleted. At that point buoyancy takes over, making the bubble clouds rise and eventually form buoyant vortex rings whose volume grows fast due to the feedback between the buoyancy-induced rising speed and the advection-enhanced CO2 transport from the bulk liquid to the bubble. The physics behind this explosive process sheds insight into the dynamics of geological phenomena such as limnic eruptions.Understanding the formation of foam in a supersaturated carbonated liquid after an impact on the container involves a careful physical description of a number of processes of great interest in several areas of Physics and Chemistry. In order of appearance in this problem: propagation of strong pressure waves in bubbly liquids, bubble collapse and fragmentation, gas-liquid diffusive mass transfer and the dynamics of bubble-laden plumes and vortex rings. All these phenomena are observed, for instance, in the explosive formation of foam occurring in a beer bottle when it is tapped on its mouth, an effect known as beer tapping. In this letter, we will use this effect as a convenient system to quantitatively describe the interaction between the processes mentioned above that ultimately leads to the explosive formation of foam that occurs in gas-driven eruptions [1]. As a consequence of the broad range of phenomena taking part in the overall process, the better understanding of the foam forming process in supersaturated liquids finds application in various fields of natural sciences and technology where similar gas-driven eruptions occur. The dynamics of limnic [1,2] or explosive volcanic [3,4] eruptions and the formation of flavour-releasing aerosols by bursting Champagne bubbles [5] are just a few examples. Mott and Woods [6] have triggered a chain reaction in a stably-stratified tank containing a deep layer of CO 2 -saturated lemonade and a shallower la...