Abstract In this research, we propose an Error Separation Technique (EST) based on optical fiber sensors for on-machine straightness error measurement. Two fiber optic Fabry–Pérot interferometers have been developed serving as two displacement sensors. The displacement distance is computed according to the reflected spectrum from interferometers, which can achieve a sub-micrometer resolution. The two-point method has been employed to separate the straightness error of the slides and the profile error of a fine-polished standard block. The spacing distance between two interferometers is determined by the diameter of optical fibers so that the EST's resolution has the potential to reach the sub-millimeter scale. In the experiment, the straightness error has been measured on a commercially available computer numerical control machine tool, and the measurement has been conducted on its x-axis. The spacing distance between two optical fiber sensors is 1.5 mm which equals the EST's resolution along the machine tool's x-axis. The separated profile error of the measured standard block is around 30 µm which has been verified by a high precision Coordinate Measurement Machine (CMM). The magnitude of the separated straightness error is around 40 µm. This technique is flexible and simple to be conducted, which can contribute to the micro-machine tool calibration and other straightness error applications.