Asked by: Keith Duncan, Edinburgh
When you shake a can, some carbon dioxide comes out of solution and bubbles form on the inside. Opening it causes a sudden drop in pressure that makes the bubbles grow much larger. It also triggers new bubbles to form, as carbon dioxide comes out of the solution around existing bubbles – points known as nucleation sites. The bubbles rise suddenly to the surface, and the whole frothy mess explodes out of the top.
Tapping the sides of the can before you open it might help to dislodge the bubbles, so the gas is all at the top of the can and there are fewer nucleation sites. But it’s only partially effective. Leaving the can to stand for a minute works better.
Subscribe to BBC Focus magazine for fascinating new Q&As every month and follow @sciencefocusQA on Twitter for your daily dose of fun science facts.