This paper introduces an in situ self-calibration method to correct Z-directional distortion associated with atomic force microscopy (AFM), which occurs mainly due to the nonlinear motion of the servo piezo-electric elements (PZT) of the AFM. The principle of the method, results of simulation and experiment are presented. In this method, the derivative of the calibration curve function of the PZT actuator is calculated from two sets of profile measurement data, which are obtained from two measurements with a small Z-direction shift. Simulation results showed that the Z-directional distortion can be compensated with an accuracy approximately twice that of the Z-directional resolution of the calibrated AFM. The effectiveness of the proposed self-calibration method was confirmed through experimental calibration of a commercially available AFM.