Hydrogen production through electrolyzing water can transfer the energy from solar energy, wind energy and other sustainable energy to hydrogen, a clean energy carrier with high energy density. The NiP<sub>2</sub> has attracted much attention as a cheap electrocatalyst with high catalytic performance for hydrogen evolution reaction (HER). In this paper, the adsorption energy, Gibbs free energy and exchange current densities at different sites on NiP<sub>2</sub> (100) surface are calculated. On this basis, the effect of strain and doping on the HER catalytic performance of NiP<sub>2</sub> are studied. By calculation, we find that when H is adsorbed on the top site of P atom on NiP<sub>2</sub> (100) surface, the exchange current density is the closest to the top of volcanic curve, so the top site of P atom on NiP<sub>2</sub> (100) surface is the catalytic active site. The effect of doping and strain on the catalytic performance of NiP<sub>2</sub> are analyzed. 1) According to the range of strain produced by the common experimental technology, the effects of 1% and 3% tensile and compressive strain are calculated. It is found that 1% compressive strain can improve the catalytic performance of NiP<sub>2</sub>, while when 3% compressive strain or a 1% or 3% tensile strain is applied, the catalytic performance of NiP<sub>2</sub> is not enhanced. 2) The effects of doping transition metal elements (Co, Fe, Mn, Mo, Cu, W, Cr) and non-metallic elements (N, C, S) on the catalytic performance of NiP<sub>2</sub> are calculated. It is found that doping non-metallic element S can significantly improve the HER catalytic performance of the top site of P atom, while the doping of transition metal elements Mn, Mo, W, Co, Cr, Fe, Cu and non-metallic elements N, C have no effect on this site. The doping of transition metal element (catalytic activity: Mn > Mo > W > Co > Cr > Fe > Ni) Mn can make the catalytic performance of inactive site improved to that of the active site, thus indirectly improving the catalytic performance of NiP<sub>2</sub>. Our work reveals the micro mechanism of the effect of doping and strain on the performance of HER electrocatalyst, which provides a new perspective for designing the high performance HER electrocatalyst.