We designed a universal digital energy spectroscopy based on online digital signal processing. A prototype system was built and tested. Signals from radiation detectors were processed via a digital filter whose coefficients could be modified without changing the hardware. The paper introduces the hardware design of the digital energy spectroscopy system as well as the full set of software consisting of the selection of the coefficients of the finite impulse response (FIR) filter and the coding in the field-programmable gate array (FPGA). The system was tested with the high purity germanium (HPGe) detector. The results showed that this prototype can achieve an energy resolution close to that of a traditional multi-channel analyzer (MCA) with a much higher counting rate. digital energy spectroscopy, FPGA, FIR filter, online digital processing, spectrum measurement Citation:Xie S X, Liang H, Sun J, et al. A digital energy spectroscopy based on FIR filter.