Phase-shifting interferometry has been widely used for the ultraprecision measurement of surface profiles. Its metrogical principle is to measure the wavefront reflected off the test surface relative to the wavefront off a reference surface, by analyzing multiple interferograms produced by the two wavefronts with different reference phases. The reference phases are introduced populary by using a piezoelectric type phase-shifter moving the test or reference surface to change relative optical path difference. In practice, due to deterministic and random errors inherent in the piezoelectric phase-shifter, the actual reference phases deviates from the intentional values so that a suitable compensation scheme is needs if measuring accuracy is to be enhanced. Previous work for the purpose has mainly concentrated on deterministic lineary compensations of the phase-shifter prior to or after obtaining interferograms. In practical measurement environment, however, phase-shifter exhibits a considerable amount of nonlinear behaviors and also the random errors caused by vibrational disturbances apper often significant. In this study, a new computational algorithm of phase- shifting interferometry which can effectively eliminate the uncertainty errors of the reference phases encountered in obtaining multiple interfrograms The algorithm treats the reference phases as additional unknowns and determines their exact values by analyzing interferograms using numerical least square technique. A series of simulations and experimental results prove that this algorithm can improve measuring accuracy being unaffected by the nonlinear and random errors of phase-shifters, compared with the conventional algoritms