The principle of projection type micro optical encoder has been described and the optics theory of grating imaging is deduced. And the encoder is developed based on MEMS technology. The integrated encoder consists of scale grating, index grating and photodiodes therefore it is compact and easy to alignment. Experiment indicates that the fabricated encoder can measure the displacement and is completely feasible and has obvious advantages both in cost and miniaturization compared with traditional optic encoder.