Imagine plopping an atom down on a scale. As you do so, skin cells that are trillions of atoms thick flake off your hand and flutter down all around it, burying it in a pile of atomic doppelgangers. Meanwhile, moisture and atmospheric particles shoot about, bouncing on and off the scale and sending its atom-sensitive needle whipping back and forth like a windshield wiper. And by the way, how did you manage to isolate a single atom in the first place?
A moment's thought shows you can't weigh an atom on a traditional scale.
Instead, physicists do it using an instrument called a mass spectrometer. Invented in 1912 by physicist J.J. Thomson and improved incrementally over the past century, it works like this: First, physicists "ionize" a gas of atoms by firing a beam of particles at the gas, which either adds electrons to the atoms in it or knocks a few of their electrons off, depending on the type of particle beam used. This gives the atoms — now known as "ions" — a net negative or positive electric charge.
Next, the ions are sent through a tube in which they're subjected to electric and magnetic fields. Both of these fields exert a force on the ions, and the strengths of the two forces are proportional to the ions' charge (neutral atoms don't feel the forces). The electric force causes the ions to change speed, while the magnetic force bends their path.
The ions are then collected by "Faraday cups" at the end of the tube, generating a current in wires attached to the cups. By measuring where and when the stream of ions hits the Faraday cups, the physicists can determine how much they must have accelerated, and in what direction, as a result of the electric and magnetic forces. Lastly, by way of Newton's second law of motion, F=ma, rearranged as m=F/a, the physicists divide the total force acting on the ions by their resulting acceleration to determine the ions' mass.
The mass of the electron has also been determined using a mass spectrometer — in that case, electrons were simply sent through the instrument themselves. That measurement enables physicists to determine the mass of an atom when it has the correct number of electrons, rather than a dearth or surplus of them.
Using a mass spectrometer, physicists have determined the mass of a hydrogen atom to be 1.660538921(73)×10−27 kilograms, where the parenthetical digits are not known with complete certainty. That's accurate enough for most purposes.
Ye olde mass
What about before the days of mass spectrometers, when chemists were fuzzy about what an atom even was? Then, they primarily measured the weights of the atoms that composed various elements in terms of their relative masses, rather than their actual masses. In 1811, the Italian scientist Amedeo Avogadro realized that the volume of a gas (at a given pressure and temperature) is proportional to the number of atoms or molecules composing it, regardless of which gas it was. This useful fact allowed chemists to compare the relative weights of equal volumes of different gases to determine the relative masses of the atoms composing them.
They measured atomic weights in terms of atomic mass units (u), where 1 u was equal to one-twelfth of the mass of a carbon-12 atom. When in the second half of the 19th century, chemists used other means to approximate the number of atoms in a given volume of gas — that famous constant known as Avogadro's number — they began producing rough estimates of the mass of a single atom by weighing the volume of the whole gas, and dividing by the number.