A new general algorithm for phase-stepping interferometry is presented. The calculation of the phase distribution is composed of three least-squares fitting procedures for an analysis of real interferograms. First, we calculate the initial phase distribution utilizing Lissajous figures and elliptic least-squares fitting. Second, we calculate the phase steps through the spatial least-squares fitting. Finally, we calculate the exact phase distribution through the serial least-squares fitting. Both insensitivity to phase-step errors and automatic calibration of phase steps for the new algorithm are confirmed by experiment. © 1999 Society of Photo-Optical Instrumentation Engineers.