A new numerical phase-measuring algorithm for digital phase-shifting interferometry is presented. In this algorithm, the actual values of phase shifts are taken as unknowns together with the wavefront phases ultimately to be determined, and they are computed through iterative spatial and serial least-squares fittings. The algorithm is more general than existing methods in that any arbitrary number of unequal phase shifts may be adopted with no prescriptive restrictions on their spacings. The algorithm is therefore found inherently free from any errors of phase shifts, allowing accurate measurement even in harsh environmental conditions with vibratory disturbances.