The atomic mass of an element is determined by the number of subatomic particles in the nucleus. The subatomic particles contained within a nucleus are called protons and neutrons.
Protons carry a positive charge, while neutrons carry no charge. Electrons, which are negatively-charged subatomic particles, do not contribute to the atomic mass of an element because their size and weight are negligible when compared to the size and weight of protons and neutrons. Many elements have several isotopes that are seen at varying rates in nature. Isotopes have different masses due to the different distribution of protons and neutrons they have in their nuclei. In these cases, the atomic mass is determined by averaging the relative rates of the isotopes and defining this average as the accepted atomic mass.