Protecting transmission lines frequently involves adopting distance relays, Protective relays must filter their inputs to reject unwanted quantities and retain signal quantities of interest. Accuracy and convergent speed of filter algorithm are essential for protective relays, A widely applied filter algorithm, the discrete Fourier transform (DFT) can easily erase harmonies using simple calculation, However, the voltage and current signals contain large harmonics and de offset during the fault interval. The de offset heavily influences the precision and convergence speed of fundamental frequency signal from DFT. In this investigation, we present a novel Fourier algorithm to remove the de offset in a voltage or current signal. Applying full-cycle DFT (FCDFT) requires one cycle plus two samples to calculate and compensate for the de offset. Half-cycle DFT (HCDFT) only requires half of a cycle plus two or three samples to accomplish the algorithm when the input signal has no even order harmonics, Adopting the proposed algorithm in distance relays effectively suppresses the de offset and quickly decomposes the accurate fundamental frequency components.