A device for optically measuring the height of a surface of an object, which device comprises a radiation source for generating an irradiating beam which is directed along a predetermined beam axis and forms an irradiated spot on the surface, and an imaging system for converging radiation reflected from the irradiated spot to a radiation beam forming an image spot on the predetermined beam axis in the image space of the image system, characterized by a detection unit arranged in the image space for receiving radiation from the radiation beam at at least three different positions along the predetermined beam axis and for converting said radiation into electric signals and by electronic means for determining, from said signals, that position of the at least three positions which receives the maximum amount of radiation, said position being related to the height of the surface at the location of the irradiated spot.