The active power filter must get the harmonic current first. The compensation performance can be improved by fast and accurate harmonic detection .The harmonic detection method of adaptive filter is studied in this paper. Then we introduced the basic principle of adaptive harmonic detection, then expound and analyzed the existing variable step-size iterative Algorithm. There are many parameters can’t be estimated of them, and the system is very sensitive to the parameters. Based on the LMS algorithm, this paper improved the harmonic detection algorithm. The algorithm develop from reducing the cost function, deduce the new step iterative formula based on adaptive gain. The Matlab simulation and DSP experiment improved the effectiveness of this algorithm.