A new hardware compensation method reducing displacement measurement errors, caused by tilt of the index scale in a moire linear encoder, has been developed. In conventional moire linear encoders, the detectors are aligned perpendicular to the line of the moire fringes and this structure is very sensitive to an unwanted tilt of the gratings. In this article, a newly designed grating, called a phase-modulated grating, is developed to compensate for nonorthogonal errors. By using the phase-modulated grating instead of a conventional index, it is possible to reduce nonorthogonal errors of the moire linear encoder. (C) 2000 American Institute of Physics. [S0034-6748(00)04506-8].