Potential gravitational energy is an energy associated with the state of separation between two objects that attract each other through the gravitational force. Thus, when we raise a body of mass m to height h we are transferring energy to the body in the form of work. The body accumulates energy and turns it into kinetic energy when we release it, returning to its initial position.
Mathematically, we can calculate the value of the potential energy of a given object as follows:
Epg = m.g.h