Voltammetric measurements showed that sodium diphenylamine sulfonate (SDS) could inhibit hydrogen evolution and form complexes with nickel and magnesium ions for Mg–Ni alloy electrodeposition. The characteristics of differential capacity curves from differential pulse anodic stripping voltammetry showed that SDS had an absorption effect on the cathode electrode. Steady state cathode polarization of Mg–Ni alloy measurements on rotating disk copper electrodes were performed, the relative results from the polarization curves indicated that SDS acted as a levelling agent. The phases and morphology of Mg–Ni alloy were examined by X-ray diffraction and scanning electron microscopy. A series of spectra showed that phenothiazine codeposited with Mg–Ni alloy. The value 0.9 of H/M (M=Mg–Ni alloy) was determined by pressure–composition isotherm measurements. The maximum discharge capacity of the alloy was 388 mAh/g; the decay of discharge capacity was studied by electrochemical impedance spectroscopy measurements.