In this paper we propose a simple optical encoder using slit-width-modulated gratings. The distortion of the encoder signal (harmonic noise) is reduced by using the slit-width-modulated gratings to obtain a sinusoidal curve. The intensity of the light transmitted through the superimposed gratings was investigated by the Fresnel diffraction theory. The Fourier coefficient of the gratings was analysed in order to reduce the distortion of the encoder signal. For practical use, the slit width of the gratings was designed to reduce the third and fifth harmonics of the encoder signal. In the experiment, the slit-width-modulated gratings were fabricated by optical lithography. It was confirmed that the signal distortion was reduced and virtually independent of the air gap between the two gratings. Since the interpolation error is considerably suppressed, the proposed technique will be useful in precision machining.