Frequency is one of important parameters of power system, real-time and accurate detection of power grid frequency are necessary for steady-state control and relay protection of power system. Traditional algorithms based on Discrete Fourier Transform or improved Discrete Fourier Transform, requiring for large amount of data, having complex calculations and poor dynamic characteristics, are difficult to be achieved. A frequency detection algorithm based on three-phase grid was proposed. Firstly three-phase voltage (or current) was transformed into dq stationary coordinate system, then through low pass digital filtering of d-axis and q-axis components fundamental components were obtained, lastly fundamental components were inversely transformed into ???? stationary coordinate system, then frequency of power grid could be obtained. This algorithm required for less data and was easy to calculate. MATLAB simulation results prove the validity of the proposed algorithm. It is easy to be implemented and has good practical value.