Porosity formation during electron beam (KB) welding of titanium alloys needs to be better understood, particularly to minimise occurrence of porosity and to provide guidance for welding process optimisation. Porosity formation in KB welding of a titanium alloy is investigated under key- liole and fully penetrating conditions. Characterisation is carried out using high resolution X-Ray tomography, residual gas analysis, and metallographic sectioning; this confirms that porosity formation is associated with gas evolution, especially hydrogen. To investigate the effect of hydrogen on porosity formation and confirm whether hydrogen is the root cause for porosity formation, TH5A1-4V samples are electrochemically charged to achieve different hydrogen levels prior to welding. The results confirm that porosity can be suppressed even at every high hydrogen levels when welding is carried out with optimised EB parameters and perfect joint alignment ;on the other hand, porosity is exacerbated when a Small beam offset (BOF) is employed This is because any BOF alters the size of the liquid zone at the melting front, where joint edges are melted. Thus the thickness of the liquid film at the melting front is crucial for bubble nucleation and their survival in the weld pool. It would appear that the nucleation rate in the liquid zone at the melting front determines the likeliliood of porosity occurrence. This suggests that BOF is likely to be one factor influencing porosity formation in these circumstances. This work provides insights into the mechanism of porosity formation during the welding of titanium alloys and guidance to aid in its elimination.