As one of the basic optical components, optical isolator is widely used in optical communication equipment. Currently the inspection for optical isolator is mainly manually done by visual inspection by workers. The manual inspection method is time-consuming and laborious, and it often hurts inspectors’ eyesight. Based on the physical structure of the optical isolator, an automatic defect inspection algorithm using liquid lens is proposed. The proposed algorithm can first locate the surface of the transparent optical isolator, then inspect several defects on the surface of the optical isolator. The experiments show that the algorithm achieves satisfactory results in the detection inspection, which can reduce the manpower demand of the visual inspection to less than 10%.