Abstract The welding process has a wide range of applications in aerospace, military manufacturing, machinery, and other fields, and with the continuous improvement of welding technology requirements, the inhibition of porosity in the welding process is also increasing. This study, through the narrow gap laser welding characteristics and porosity formation mechanism of the depth of analysis, for the existing narrow gap laser welding method exists in the side wall of the weld fusion is poor porosity, poor uniformity of organizational properties and other issues, proposed ultrasonic-based welding method to achieve effective inhibition of porosity. The experimental analysis of ultrasonic vibration on the formation of porosity is carried out based on narrow-gap laser welding. The peak sound pressure of narrow gap welding increases when the ultrasonic current amplitude changes from 24A to 32A. Under different ultrasonic vibration conditions, the number of welds without applied ultrasound was as high as 95, while the number of porosities gradually decreased to 48 with the increase of applied ultrasound amplitude from 12% to 37%. Furthermore, as the ultrasonic amplitude increased, the residual height decreased by 0.45 ml. In addition, at fixed ultrasonic amplitude, with the increase of laser power, the porosity increased from 0.89% to 2.21%, and the average diameter of the porosity increased from 0.29 mm to 0.43 mm. The porosity for the porosity diameter of less than 200 μm was reduced to 0.020%. The percentage of stomata with a diameter greater than or equal to 200μm increased to 2.098%. This study analyzes the inhibition effect of ultrasonic vibration on porosity to a certain extent. Moreover, the inhibition effect of ultrasonic vibration in narrow gap laser welding is significant and the smaller the laser power under the same amplitude, the better the inhibition effect, which provides a valuable reference for the research of the narrow gap laser welding process.