The invention provides a method and a device for simultaneously measuring five degrees-of-freedom errors based on light beam drift compensation. The method and the device are used for solving the problems of low measurement precision, small measurement range and poor anti-interference capability of the existing high-precision simultaneous measurement method for guide rail five degrees-of-freedom. A collimating lens, a prism assembly, a polarization beam splitting prism and a quarter-wave plate are arranged between a laser device and a right-angle prism plated with a beam splitting film, so as to realize processing of incident light and reflected light, information of the reflected light and transmitted light after beam splitting is received and measured by means of a four-quadrant detector and a position sensitive detector, and the measurement of pitch angle, deflection angle and rolling angle errors, horizontal straightness errors, vertical straightness errors and light drift compensation are realized. The method and the device utilize double beam differential measurement to realize error separation, enhance the anti-interference capability, employ few optical devices and are low in light source power and cost; the optical structure is simple, the operation is convenient, the moving parts are not required to be provided with cables, and the field measurement is facilitated; and the angle measurement resolution is high.