Why does a bottle of soda spew when shook?

A bottle of soda spews when shaken due to the rapid release of carbon dioxide gas dissolved in the liquid. When the bottle is shaken, the liquid becomes agitated, and the dissolved gas bubbles come out of solution and form larger bubbles. These larger bubbles rise to the surface and burst, releasing the gas into the air. The sudden release of a large amount of gas creates pressure inside the bottle, causing the liquid to spray out when the bottle is opened.

The amount of spewing depends on several factors, including the amount of carbon dioxide dissolved in the soda, the temperature of the soda, and the amount of shaking. Warmer soda contains less dissolved gas than cold soda, so it will spew less when shaken. Similarly, soda that has been shaken vigorously will spew more than soda that has been shaken gently.

To avoid soda spewing, it is best to keep it cold and shake it gently, if at all.