Breaking ocean waves entrain air bubbles that enhance air-sea gas flux, produce aerosols, generate ambient noise and scavenge biological surfactants. The size distribution of the entrained bubbles is the most important factor in controlling these processes, but little is known about bubble properties and formation mechanisms inside whitecaps. We have measured bubble size distributions inside breaking waves in the laboratory and in the open ocean, and provide a quantitative description of bubble formation mechanisms in the laboratory. We find two distinct mechanisms controlling the size distribution, depending on bubble size. For bubbles larger than about 1 mm, turbulent fragmentation determines bubble size distribution, resulting in a bubble density proportional to the bubble radius to the power of -10/3. Smaller bubbles are created by jet and drop impact on the wave face, with a -3/2 power-law scaling. The length scale separating these processes is the scale where turbulent fragmentation ceases, also known as the Hinze scale. Our results will have important implications for the study of air-sea gas transfer.