The multiple error of digital energy meter was found out of range constantly in the process of application, one of the main reason is that the poor suitability of existing digital energy algorithm. In this paper, several error factors have been analyzed, and a new digital energy metering algorithm based on all-phase data processing has been proposed. This algorithm combines traditional DFT with all-phase data processing, and enhances the frequency adaptability of all-phase data processing. The simulation results verify that this algorithm can suppress the spectrum leakage. Compared with similar products of mainstream manufacturers, it can be seen that this algorithm has better adaptability than others, it can be used to measure energy in complex conditions.