A smart optical liquid level sensor based on the theory of connected vessels is introduced. The Hg cladding optical waveguide (HCOW) is taken as its probe, and the change of liquid level is presented by the change of the HCOW length. Both the theoretical analysis and experiments show that when the waveguide diameter and the light wavelength are certain, the optical power loss decreased linearly with the increase of the HCOW length. By detecting the power loss of HCOW, optimizing the structure of probe and selecting the appropriate apparatus for detection, the real time detection of liquid level with high precision can be got. The experimental results show that the measurement accuracy is 5.2 mm within 10 m liquid level, and its theoretical precision can be up to 0.02%.