A height measuring device comprising: a light source configured to emit light in a direction oblique to a top surface of a specimen; a slit configured to shape the light from the light source to form a slit image on the specimen; an imaging element configured to detect reflected light reflected by the specimen; and an arithmetic unit configured to determine a height of the top surface of the specimen based on a result of detection of the slit image by the imaging element, characterised by the arithmetic unit configured to perform processing of: determining whether or not a plurality of slit images is detected; identifying, when the arithmetic unit has determined that a plurality of slit images are detected by the imaging element, a slit image of the reflected light reflected by the top surface of the specimen from among the plurality of slit images based on respective positions of the plurality of slit images on a detection surface of the imaging element; determining the height of the top surface of the specimen based on the position of the center of the slit image of the reflected light reflected by the top surface of the specimen on the detection surface; and determining, when the arithmetic unit has determined that a plurality of slit images are not detected by the imaging element, the height of the top surface of the specimen based on the position of the center of a detected slit image. a light source configured to emit light in a direction oblique to a top surface of a specimen; a slit configured to shape the light from the light source to form a slit image on the specimen; an imaging element configured to detect reflected light reflected by the specimen; and an arithmetic unit configured to determine a height of the top surface of the specimen based on a result of detection of the slit image by the imaging element, characterised by the arithmetic unit configured to perform processing of: determining whether or not a plurality of slit images is detected; identifying, when the arithmetic unit has determined that a plurality of slit images are detected by the imaging element, a slit image of the reflected light reflected by the top surface of the specimen from among the plurality of slit images based on respective positions of the plurality of slit images on a detection surface of the imaging element; determining the height of the top surface of the specimen based on the position of the center of the slit image of the reflected light reflected by the top surface of the specimen on the detection surface; and determining, when the arithmetic unit has determined that a plurality of slit images are not detected by the imaging element, the height of the top surface of the specimen based on the position of the center of a detected slit image. determining whether or not a plurality of slit images is detected; identifying, when the arithmetic unit has determined that a plurality of slit images are detected by the imaging element, a slit image of the reflected light reflected by the top surface of the specimen from among the plurality of slit images based on respective positions of the plurality of slit images on a detection surface of the imaging element; determining the height of the top surface of the specimen based on the position of the center of the slit image of the reflected light reflected by the top surface of the specimen on the detection surface; and determining, when the arithmetic unit has determined that a plurality of slit images are not detected by the imaging element, the height of the top surface of the specimen based on the position of the center of a detected slit image.