The invention discloses a method and device for measuring microstructure morphology based on spectral modulation depth coding. An element to be measured and a spatial light modulator are conjugated atthe center wavelength of the spectral range used in the measurement; a beam folding coupler, the spatial light modulator, a collimating and expanding lens, a beam splitter, an axial non-achromatic microscope objective lens, an imaging lens and a color camera are in a common optical path structure. During the measurement, the pre-calibration of the corresponding relation of the 'spectral-depth' isfirstly carried out on a system device, and each frame monochromatic shift-phase fringe pattern reflected by the element to be measured is acquired by a measuring device, so as to obtain the modulation depth distribution of each monochromatic light fringe pattern related to the surface shape of the element to be measured, and the coded image is obtained; the 'spectrum-modulation depth' relation curve of each point on the surface to be measured is determined by using Gaussian, quasi-Gaussian or spline model fitting, the depth information of each point on the surface to be measured is demodulated, and the fast and precise measurement of the microstructure topography of the three-dimensional topography distribution of the element to tested, without mechanical scanning or contact, is completed.