Moles are a unit that used as a stepping stone between grams (which can be measured with devices in a lab setting) and the amount of particles in something (which is hard to get a precise measurement of). Anything that is based on specific particle to particle interactions can use moles in calculations because of this. One mole represents 6.022 x 1023 molecules. This number is also known as Avogadro’s Number.
Molecules = Moles x Avogadro's Number
Atoms = Molecules x Atoms in Formula
We can also use division instead of multiplication to go the other way with our formulas. An example of a complete conversion is as follows:
You can use the mass of a compound to figure out how many moles, molecules, and/or atoms are in something that you weigh! To convert we do the following:
Actual Mass = Moles x Mass from Periodic Table
The masses for elements on the periodic table are the mass of a single mole of that element! That is, 6.022 x 1023 atoms of that element. We can find the formula/molar mass (the mass of a compound per mole) by adding up the total number of masses on the periodic table for all of its elements.
The mass numbers on the periodic table are the averages for each element but there's so many particles in any large sample we use that it should always be close enough to that amount to ignore any error that would turn up! Hydrogen will always be 1.008 grams for every mole of particles, helium will always be 4.016, and so on.
Mass is based on grams while moles are based on the actual amounts of particles you are dealing with.