We present a new computational algorithm of phase-shifting interferometry that can effectively eliminate the uncertainty errors of reference phases encountered when we obtain multiple interferograms. The algorithm treats the reference phases as additional unknowns and we determine their exact values by analyzing interferograms using the numerical least-squares technique. A series of simulations prove that this algorithm can improve measuring accuracy because it is unaffected by the nonlinear and random errors of phase shifters.