In the conventional frequency measuring algorithm, first the phases of two adjacent periods are obtained using Fourier transform, then the phase difference is used to perform modification and iteration for the sampling frequency. This algorithm asks for a lot of calculation but is inaccurate. Based on strict mathematical deduction, this paper presents an accurate mathematical expression using Fourier transform, which is composed of the cosine function for the phase difference. Then after trigonometric function decomposition, the cosine function for the phase difference can be expressed with the Fourier transform results. Hence, the real signal frequency can be obtained without calculating the precise phases of the two periods. Simulation results show that the new algorithm is suitable for application in microcomputer-based monitoring and protective devices for its high accuracy, low calculating workload and easy implementation.