In-plane linear displacements of microelectromechanical systems are measured with subnanometer accuracy by observing the periodic micropatterns with a charge-coupled device camera attached to an optical microscope. The translation of the microstructure is retrieved from the video by phase-shift computation using discrete Fourier transform analysis. This approach is validated through measurements on silicon devices featuring steep-sided periodic microstructures. The results are consistent with the electrical readout of a bulk micromachined capacitive sensor, demonstrating the suitability of this technique for both calibration and sensing. Using a vibration isolation table, a standard deviation of σ = 0.13 nm could be achieved, enabling a measurement resolution of 0.5 nm (4σ) and a subpixel resolution better than 1/100 pixel.