Due to environmental interference and atmospheric disturbance and other factors, the interference fringes are always drifting. So, the traditional hardware phase shift could not meet the high accuracy demodulation of interference. In this paper, virtual phase shift based on moiré fringes are introduced to realize the phase demodulation of interference fringe. The virtual digital phase shifting interference fringes are generated by computer, and superposed with tested interference fringe to generate phase shifting moire fringe, which are processed through applying phase shift demodulation techniques and the Fourior transform then to obtain the phase information tested. To verify the technique here, a specific experiment for a diameter of 50mm flat optics is executed, and the experimental result is compared with ZYGO-verifire PE interferometer. Our method eliminates the nonlinear error of the hardware phase shifter while improving the processing accuracy, and especially suitable for high-precision testing for optical component with complex environment or for large-aperture optical component, or even the system greatly simplifies the structure of interferometer.