Theory:

As you know, anything that has mass and occupies space is called matter.
Atoms are the fundamental constituents of matter. As the matter has mass, it must be because of its atoms. According to modern atomic theory, an atom comprises subatomic particles like protons, neutrons, and electrons. Protons and neutrons have considerable mass, but electrons do not have. As a result, protons and neutrons contribute the majority of an atom's mass, and the total of an atom's protons and neutrons is known as its mass number.
 
Since individual atoms are so small, mass measurements are difficult. The mass of macroscopic materials can be measured in grams or kilograms. The mass of an atom is measured in the atomic mass unit (amu). One atomic mass unit equals one-twelfth of the mass of a carbon-\(12\) atom, which contains \(6\) protons and \(6\) neutrons.

In the present system, the symbol ‘amu' is no longer used to denote unified atomic mass; instead, the symbol ‘U' is used. A proton or neutron has a mass of roughly \(1\) amu.
Relative atomic mass
The absolute mass of an atom cannot be calculated directly due to its small size. The atomic mass of an atom was measured in relation to the atomic mass of another element by the early pioneers of chemistry. To determine their relative masses, they measured the masses of an equal number of atoms from two or more elements at the same time. They chose one element as a standard, assigned it an arbitrary atomic mass value, and measured the relative masses of other elements using this value. The mass obtained by this way is known as relative atomic mass. Because of the isotopic character of hydrogen (\(_{1}\textrm{H}^{1}\), \(_{1}\textrm{H}^{2}\), \(_{3}\textrm{H}^{1}\)), its mass was initially chosen as a standard and masses of other atoms were compared with it. Later, the hydrogen atom was replaced as the standard by the oxygen atom. The stable isotope of carbon (\(C-12\)) with atomic mass \(12\) is now the standard for determining an element's relative atomic mass.
 
The relative atomic mass of an element is the ratio between the average mass of its isotopes to 112th part of the mass of a carbon-\(12\) atom. It is denoted as \(A_r\). On the other hand, it is called as “Standard Atomic Weight”.
 
RelativeatomicmassAr=Averagemassoftheisotopesoftheelement112thofthemassofoneC12atom
 
The mass of an atom can be determined using modern methods such as mass spectrometry. The standard of spectrometry is \(C-12\). The relative atomic mass of most elements is very close to a whole number; hence it is rounded off to a whole number to simplify the calculations. Some of the elements of the periodic table and their \(A_r\) values are listed in the below table.
 
Relative atomic masses of elements (\(C-12\) scale)
 
Elements
Symbol
\(A_r\)
Hydrogen
\(H\)
\(1\)
Carbon
\(C\)
\(12\)
Nitrogen
\(N\)
\(14\)
Oxygen
\(O\)
\(16\)
Sodium
\(Na\)
\(23\)
Magnesium
\(Mg\)
\(24\)
Sulphur
\(S\)
\(32\)
 
Relative Atomic Mass is only a ratio; hence, it does not have a unit. If the atomic mass of an element is expressed in grams, it is called Gram Atomic Mass.
Example:
Gram Atomic Mass of hydrogen \(= 1\) \(g\)
Gram Atomic Mass of carbon \(= 12\) \(g\)
Gram Atomic Mass of nitrogen \(= 14\) \(g\)
Gram Atomic Mass of oxygen \(= 16\) \(g\)