The mass defect of a nucleus is defined as the difference between the mass of the separated nucleons and the combined mass of the nucleus.
To calculate the mass defect ΔM for a nucleus that has A protons and B neutrons:
ΔM = Amp + Bmn – Mn, where
mp = mass of a proton
mn = mass of a neutron
Mn = mass of the nucleus
To calculate the mass defect of a neutral(number of proton = number of electron) whole atom ΔMa:
ΔMa = Amp + Bmn + Ame – Ma, where
me = mass of an electron
Ma = mass of the neutral atom