A high resolution noncontact optical sensor for surface roughness has been developed. The principle of the sensor is based on astigmatic focus error detection, which has been employed in the pickup of optical disk players. First, the measuring principle of the method and the optical system arrangement are described in detail. Then, the results obtained by this method are compared with those obtained by the precise diamond stylus method on several different types of surfaces. The light source of the newly developed apparatus is a diode laser with an output power of 2 mW and a wavelength of 790 nm. The objective lens of the sensor is a standard microscope objective, interchangeable with other objectives. The sensor is small enough for on-machine use and has shown sensitivities on the order of nanometers on diamond-turned metal mirrors. It also permits on-machine measurement of surface profiles in cases in which the object surface is mounted on a machine tool.