We have investigated the effects of B impurities on the structure and mechanical properties of NiAl intermetallics by using a first-principles pseudopotential total-energy method, based on the density functional theory with a generalized gradient approximation. We found that the impurity B atoms can either replace Ni atoms or Al atoms or both, depending on the surrounding environment. We demonstrated that the presence of B will cause an increase in brittleness and a decrease in the ductility of NiAl for the Al-substitutional case, while causing an increase in the ductility of NiAl for the Ni-subtitutional case, based on the calculated elastic constants and the empirical criterions. This indicates that the effects of B impurities on the mechanical properties of NiAl intermetallics are quite composition-dependent.