Provided is a confocal sensor having a wider measuring range. A confocal sensor 1 comprises: a light source 10 that emits light at a plurality of wavelengths; a diffractive lens 130 that causes a chromatic aberration with respect to the light along an optical axis and focuses the light onto an object 200 without another intervening lens; a pinhole 120 through which reflected light passes, the reflected light being a portion of the light that was focused onto and reflected from the object 200 and focused by the diffractive lens 130; and a measuring unit 40 that measures the distance from the diffractive lens 130 to the object 200 on the basis of a wavelength of the reflected light. A distance L2 from the pinhole 120 to the diffractive lens 130 is variable. |