Before we get into the subject of gravity and how it acts, it's important to understand the difference between weight and mass .
We often use the terms "mass" and "weight" interchangeably in our daily speech, but to an astronomer or a physicist they are completely different things. The mass of a body is a measure of how much matter it contains. An object with mass has a quality called inertia . If you shake an object like a stone in your hand, you would notice that it takes a push to get it moving, and another push to stop it again. If the stone is at rest, it wants to remain at rest. Once you've got it moving, it wants to stay moving. This quality or "sluggishness" of matter is its inertia. Mass is a measure of how much inertia an object displays.
Weight is an entirely different thing. Every object in the universe with mass attracts every other object with mass. The amount of attraction depends on the size of the masses and how far apart they are. For everyday-sized objects, this gravitational pull is vanishingly small, but the pull between a very large object, like the Earth, and another object, like you, can be easily measured. How? All you have to do is stand on a scale! Scales measure the force of attraction between you and the Earth. This force of attraction between you and the Earth (or any other planet) is called your weight.
If you are in a spaceship far between the stars and you put a scale underneath you, the scale would read zero. Your weight is zero. You are weightless. There is an anvil floating next to you. It's also weightless. Are you or the anvil mass-less? Absolutely not. If you grabbed the anvil and tried to shake it, you would have to push it to get it going and pull it to get it to stop. It still has inertia, and hence mass, yet it has no weight. See the difference?
As stated above, your weight is a measure of the pull of gravity between you and the body you are standing on. This force of gravity depends on a few things. First, it depends on your mass and the mass of the planet you are standing on. If you double your mass, gravity pulls on you twice as hard. If the planet you are standing on is twice as massive, gravity also pulls on you twice as hard. On the other hand, the farther you are from the center of the planet, the weaker the pull between the planet and your body. The force gets weaker quite rapidly. If you double your distance from the planet, the force is one-fourth. If you triple your separation, the force drops to one-ninth. Ten times the distance, one-hundredth the force. See the pattern? The force drops off with the square of the distance. If we put this into an equation it would look like this:
The two "M's" on top are your mass and the planet's mass. The "r" below is the distance from the center of the planet. The masses are in the numerator because the force gets bigger if they get bigger. The distance is in the denominator because the force gets smaller when the distance gets bigger. Note that the force never becomes zero no matter how far you travel. Perhaps this was the inspiration for the poem by Francis Thompson:
This equation, first derived by Sir Isaac Newton, tells us a lot. For instance, you may suspect that because Jupiter is 318 times as massive as the Earth, you should weigh 318 times what you weigh at home. This would be true if Jupiter was the same size as the Earth. But, Jupiter is 11 times the radius of the Earth, so you are 11 times further from the center. This reduces the pull by a factor of 11 2 resulting in about 2.53 times the pull of Earth on you. Standing on a neutron star makes you unimaginably weighty. Not only is the star very massive to start with (about the same as the Sun), but it is also incredibly small (about the size of San Francisco), so you are very close to the center and r is a very small number. Small numbers in the denominator of a fraction lead to very large results!