The tool correction sensor enables automatic input of the tool length correction value mounted in the CNC chuck or directly in the spindle. The machine tool automatically measures the length of the tool, then corrects the Z axis coordinate so that the end of the tool is at the appropriate height. In machines equipped with an automatic tool change, the measurement may be performed once or before each use. It is also possible to measure the tool after machining to check for damage.