Abstract Atomic and electronic structures of liquid and rapidly quenched Ni–Al (NiAl 3, NiAl, and Ni 3Al) alloys were studied by ab initio molecular dynamics simulation. Pair correlation function, structure factor, bond pair, electron population, and density of states were calculated. It is found that amorphous Ni–Al alloys can be prepared by rapid quenching of liquid alloys, with the former bearing similar structures to the latter, although amorphous alloys have a more ordered structure. Bond pair analysis indicates that both the liquid and amorphous Ni–Al alloys consist mainly of 1441, 1431, 1421, and 1422 pairs of tetrahedral local order. The positions of the first peaks of the Al–Ni pair correlation functions are lower than the sum of the metallic radii of Ni and Al, suggesting the occurrence of chemical bonding between Ni and Al in Ni–Al alloys. Electronic structure analysis further revealed that the interaction between the d-electrons of Ni and the p-electrons of Al is responsible for the bonding. The main peak positions of the total DOS of amorphous Ni–Al alloys become more and more positive when the content of Ni in the alloys increases.