Mass (in grams) = (number of atoms) * (atomic mass)
Where atomic mass is the mass of one atom of the element expressed in atomic mass units (amu).
For example, to convert 1 mole of carbon atoms (which is equivalent to 6.022 x 10^23 atoms) to grams, we need to multiply the number of atoms by the atomic mass of carbon, which is approximately 12 amu.
Mass of 1 mole of carbon = (6.022 x 10^23 atoms) * (12 amu/atom) = 72.26 grams
This formula can be extended to find the mass of a compound by summing up the masses of its constituent atoms.