Now the machine tools industry is very prevailed, there are different types of machine tools. If the machine is too large, it will produce errors. If we can write a program to do measurement and do error compensation, we can improve the precision of machine tools. That is the purpose of this study. The purpose of this research is to compensate the Z axis error for long travel column machine. First thing we need to do is to build the error map of the working plane for machine tools. When the error map is constructed, it can be used to compensate the error. In this research we use laser light and position sensing detector to measure the straightness error of the machine tool. After measured position error of all the plane error, we can use curve fitting method to obtain the error map. Then, compensate the X-Y plane error of machine tools can be done.