When protons and neutrons join together they are held by “the strong force”. This is a very powerful , short range attractive force which overcomes the repulsion between the protons.
When a nucleus of several particles is formed they are at a lower energy level than when they are apart. The change in energy as they join is so large that it results in a significant change in mass.
The amount of energy that is released by the nucleons (protons and neutrons) as they join up is called the binding energy, that is the energy that binds them together.
Another way of saying this is that the binding energy of an atom is the amount of energy that would be needed to completely pull apart all of the nucleons (that is the protons and neutrons) in the nucleus.
To get the binding energy per nucleon we divide this binding energy for the atom by the number of nucleons it has in it.
In the graph below the atoms with the most binding energy have the least energy when all the nucleons are combined and so they are the most stable.
The image below is a page of notes explaining atomic stability in more detail and depth. Download it here:atomic stability