In reference to a certain isotope of a chemical element, atomic mass though also called relative atomic mass is the mass of one atom of the isotope expressed in units (atomic mass unit, amu) such that the Carbon-12 isotope has an atomic mass of exactly 12. No other isotope mass works out to a whole number due to the effects of binding energy.
The atomic or isotope mass number is the sum of the neutrons and protons in the nucleus of the atom. Mass number is always a whole number and is simply a sum of the nucleons within the nucleus of the isotope.
In reference to a certain chemical element, atomic mass (also called relative atomic mass or average atomic mass) as shown in the periodic table is the average atomic mass of the chemical element's isotopes. The average is weighted by the relative natural abundances of the element's isotopes. This is the atomic mass used in stoichiometric calculations. This is usually used a a mass in grams of one mole of the element's atoms, often referred to as the gram atomic mass or molar mass.
The old term atomic weight is being phased out slowly and being replaced by relative atomic mass, in most current usage.
A similar definition applies to molecules; it is then called molecular mass. It turns out that one can compute the molecular mass of a compound by adding the atomic masses of its constituent atoms guided by the ratios of elements given in the chemical formula. A similar formula mass can be calculated for those compounds which do not form molecules.
Direct comparison and measurement of the masses of atoms and molecules is achieved with mass spectrometry.
One mole of a substance always contains exactly the atomic or molecular mass of that substance, expressed in grams. For example, the atomic mass of iron is 55.847, and therefore one mole of iron atoms has a mass of 55.847 grams.
Before the 1960s, this was expressed so that the Oxygen-16 isotope received the atomic mass 16, however, the proportions of Oxygen-17 and Oxygen-18 present in natural oxygen, which were also used to calculate atomic mass led to two different tables of atomic mass.
Formerly chemists and physicists used two different atomic mass scales. The chemists used a scale such that the natural mixture of oxygen isotopes had an atomic mass 16, while the physicists assigned the same number 16 to the atomic mass of the most common oxygen isotope (containing eight protons and eight neutrons). The current unified scale based on Carbon-12 met the physicists' need to base the scale on a pure isotope, while being numerically close to the old chemists' scale.