Gravitational potential energy is given by equation U = -GMm/r where G is gravitational constant, M and m are masses of two objects and r is the distance between these two masses. Now, we know that energy and work have strong connection, therefore a better way to think of the concept of gravitational potential energy is to think of it as the amount of work needed to move an object of mass m from an infinite distance from mass M to distance r from mass M. The work needed to move the mass m from infinity to distance r from mass M is the gravitational potential energy.