A new seven-sample algorithm is derived, based on the Surrel six-sample algorithm, by using the averaging technique. The sensitivities of phase-shifting algorithms to phase-shift error and harmonics of nonsinusoidal waveforms are analyzed by the Fourier description method. Plots of the root-mean-square phase error, produced by computer simulation, are presented in order to compare the new algorithm with the other four well-known phase-shifting algorithms. It is shown that the new algorithm is the least sensitive to linear phase-shift error and to quadratic nonlinear phase-shift error with linear compensation, when the fringe signal contains the second-harmonic distortion. A 3-D fringe projection phase-shifting profilometer was constructed using a white light source and projecting a quasisinusoidal grating with some second-harmonic distortion. Experiments were carried out to compare the five phase-shifting algorithms when different phase-shift errors exist, and the shape of a 3-D object was measured using the new seven-sample algorithm. © 1999 Society of Photo-Optical Instrumentation Engineers.