Calculate the force of attraction between two objects with F = Gm₁m₂/r² from their masses and distance, or the electrostatic force between two charges.

Newtonian gravity for point masses or non-overlapping spherical bodies. Measure distance between centres.

Optional settings

Calculator Functions

FunctionWhat it doesWhat it requires
Gravity: forceFinds the gravitational attraction between two massesRequires both masses and the centre-to-centre distance
Gravity: first massFinds the first mass from the attraction it producesRequires the second mass, the distance and the force magnitude
Gravity: second massFinds the second mass from the attraction it producesRequires the first mass, the distance and the force magnitude
Gravity: distanceFinds how far apart two masses are for a known attractionRequires both masses and the force magnitude
Gravity and weightFinds the gravitational acceleration at a distance from a body, and the weight of an object thereRequires the central body mass and the distance from its centre, with an object mass as an option
Electric: forceFinds the force between two point charges and whether they attract or repelRequires both signed charges, the distance and the relative permittivity
Electric: charge 1 magnitudeFinds the size of charge 1 from the forceRequires charge 2, the distance, the force magnitude and the relative permittivity
Electric: charge 2 magnitudeFinds the size of charge 2 from the forceRequires charge 1, the distance, the force magnitude and the relative permittivity
Electric: distanceFinds the separation of two charges for a known forceRequires both charges, the force magnitude and the relative permittivity
Escape, orbit and energyFinds the escape speed and circular orbit speed at a distance from a bodyRequires the central body mass and the distance from its centre, with an object mass as an option

Masses are entered in kg or lb, distances in m, cm, mm, km, ft or in, forces in N or lbf and charges in C, mC, μC, nC or pC. Distances are always measured between centres. Gravity: force offers ready-made examples, and the two body functions can fill in the mass and mean radius of Earth, the Moon, Mars, Jupiter or the Sun.

Attraction Force Formulas

F = G × m1 × m2 ÷ r² [1]
FForce of attraction (N)
GGravitational constant, 6.67430 × 10−11 N·m²/kg² [2]
m1First mass (kg)
m2Second mass (kg)
rDistance between the centres of the two masses (m)

Gravity: force

Every object attracts every other with a force proportional to both masses and inversely proportional to the square of the distance between them, directed along the line joining them [1]. Two 1 kg masses 1 m apart attract with 6.6743 × 10−11 N. A 70 kg person at Earth’s mean radius is pulled with 687.42 N.

Gravity: first mass

m1 = F × r² ÷ (G × m2)

The known mass must be above zero, since a zero mass produces no force.

Gravity: second mass

m2 = F × r² ÷ (G × m1)

This is the same rearrangement with the masses swapped.

Gravity: distance

r = √(G × m1 × m2 ÷ F)

The force must be above zero, because two masses never attract with exactly zero force at a finite distance.

Gravity and weight

g = G × M ÷ r²

M is the mass of the central body and r is the distance from its centre. Adding an object mass m gives its weight, m × g. A spherical body pulls on an outside object as though all of its mass sat at its centre [3], so a surface value comes from entering the body’s radius as r. The body presets use these masses and mean radii [4]:

BodyMass (kg)Mean radius (km)g at that radius (m/s²)
Earth5.9722 × 10246,3719.82
Moon7.346 × 10221,737.41.62
Mars6.4169 × 10233,389.53.73
Jupiter1.89813 × 102769,91125.92
Sun1.9884 × 1030695,700274.20

Electric: force

F = k × |q1 × q2| ÷ (εr × r²) [5]

k is the Coulomb constant, 1 ÷ (4π × ε0), about 8.98755 × 109 N·m²/C² [6], and εr is the relative permittivity of the material between the charges, 1 for a vacuum [7]. Charges with opposite signs attract and charges with the same sign repel. Charges of +1 μC and −2 μC that are 0.1 m apart in a vacuum attract with 1.7975 N.

Electric: charge 1 magnitude

|q1| = F × εr × r² ÷
(k × |q2|)

The force magnitude gives the size of the charge only. It cannot show whether the charge is positive or negative.

Electric: charge 2 magnitude

|q2| = F × εr × r² ÷
(k × |q1|)

This is the same rearrangement with the charges swapped.

Electric: distance

r = √(k × |q1 × q2| ÷
(εr × F))

Both charges and the force must be nonzero.

Escape, orbit and energy

vesc = √(2 × G × M ÷ r)

The circular orbit speed at the same distance is √(G × M ÷ r), which is the escape speed divided by √2. With an object mass m, the potential energy is U = −G × M × m ÷ r, counted as zero infinitely far away [3]. The escape speed is the speed at which kinetic energy just cancels that potential energy. From Earth’s mean radius it is 11.186 km/s and the circular speed is 7.910 km/s.

Limits of This Estimate

  • The gravity formulas treat each body as a point or a sphere and measure between centres. They do not cover irregular shapes, points inside a body, or gravity strong enough to need relativity. An escape speed at or above the speed of light is rejected.
  • The body functions leave out rotation and atmosphere, and they use the mean radius, so g can differ a little from a value measured at a particular place on the surface.
  • Coulomb’s law in this form is for charges at rest [5]. Dividing by εr is correct only when one uniform fluid fills the space around the charges, and εr is only roughly constant for real materials [7].
  • G is known to about five significant figures [2], so gravitational results are not exact beyond that.

Sources