The effect of light impurities (C, N) upon the electronic structure of the (010) edge dislocation core in NiAl single crystals is investigated by using the Dmol and the discrete variational method within the framework of density functional theory. The impurity segregation energy, interatomic energy and charge distribution are calculated, and the effects of impurity atoms upon the dislocation motion are discussed. The energy analysis shows that both C and N atoms can stabilize the (010) edge dislocation core, and prefer to occupy the interstitial site in the Center-Ni dislocation core. Meanwhile, the impurity atoms can form strong bonding states with their neighboring host atoms via hybridization between the 2p orbitals of the impurity atom and the 3d4s4p orbitals of the host Ni atoms; as well as between the 2p orbitals of the impurity atom and the 3s3p orbitals of the host Al atoms. The strong interaction between impurity atom and host atoms in the dislocation core may improve the strength of NiAl single crystals.