Experimental and theoretical analysis of the origin of porosity in electron-beam (EB) welding is detailed. The experiments are run with several surface treatments and reasonable welding parameters. The plate faces are characterized before welding with a number of methods, such as scanning electron microscope observation, X-ray photoemission spectroscopy (XPS) and, more significantly, secondary ion mass spectroscopy (SIMS) analysis, elastic-recoil detection analysis (ERDA) for hydrogen analysis, and surface roughness measurement. After welding, pores are sought with X-ray detection, phased-array ultrasonic (US) detection, and destructive control. An original comparison between ERDA and refined SIMS measurements allows a quantitative evaluation of surface pollution with hydrogen, oxygen, and carbon. The theoretical analysis is based on the literature concept that the cavities are nucleated from the adjacent plate faces in the solid state, just before melting. A less classical development is proposed in term of the evolution of bubbles in the weld pool. Once in the liquid, the cavities become bubbles. Their radius oscillates, according to Rayleigh-Plesset equations of bubbles, due to temperature and pressure driving forces. Solidification freezes them as they are, thus, forming pores. The extreme values of the oscillation give a good idea of the range of the size of pores in the weld joint, as the comparison between experiments and prediction states. A criterion of surface cleanliness is set, relating the surface pollution and the surface roughness. Above the criterion, the bubbles remain small during their oscillation. Below the criterion they tend to grow large. All the degraded-surface treatments are in dirty situation (large pores), and the reference surface treatment lies around the criterion for cleanliness.