The potential energy of a body is due to its higher position above the earth and it is equal to the work done on the body, against gravity, in moving the body to that position. So, to find out the potential energy of a body lying at a certain height, all that we have to do is to find out the work done in taking the body to that height.
Suppose a body of mass m is raised to a height h above the surface of the earth. The force acting on the body is the gravitational pull of the earth m x g which acts in the downward direction. To lift the body above the surface of the earth, we have to do work against this force of gravity. Now,
Work done = Force x Distance
So, W=m x g x h
This work gets stored up in the body as potential energy.
Thus, Potential energy = m x g x h
where m = mass of the body
g = acceleration due to gravity and
h = height of the body above a reference point, say the surface of earth
The potential energy can also be acquired by a body due to change in its shape. For example, a bent bow and a stretched rubber band possess potential energy which is due to the change in their normal shapes.