In chromatic confocal line sensors, calibration is usually divided into peak extraction and wavelength calibration. In previous research, the focus was mainly on peak extraction. In this paper, a kernel-based algorithm is proposed to deal with wavelength calibration, which corresponds to the mapping relationship between peaks (i.e., the wavelengths) in image space and profiles in physical space. The primary component of the mapping function is depicted using polynomial basis functions, which are distinguished along various dispersion axes. Considering the unknown distortions resulting from field curvature, sensor fabrication and assembly, and even the inherent complexity of dispersion, a typical kernel trick-based nonparametric function element is introduced here, predicated on the notion that similar processes conducted on the same sensor yield comparable distortions.To ascertain the performance with and without the kernel trick, we carried out wavelength calibration and groove fitting on a standard groove sample processed via glass grinding and with a reference depth of 66.14 μm. The experimental results show that depths calculated by the kernel-based calibration algorithm have higher accuracy and lower uncertainty than those ascertained using the conventional polynomial algorithm. As such, this indicates that the proposed algorithm provides effective improvements.