One somewhat counterintuitive feature of escape velocity is that it is independent of direction, so that "velocity" is a misnomer; it is a scalar quantity and would more accurately be called "escape speed".
The simplest way of deriving the formula for escape velocity is to use conservation of energy.
Defined a bit more formally "escape velocity" is the initial speed required to go from an initial point in a gravitational potential field to infinity with a residual velocity of zero, relative to the field. In common usage, the initial point is a point on the surface of a planet or moon. It is a theoretical quantity, because it assumes that an object is fired into space like a bullet. Instead propulsion is almost always used to get into "space". It is usually in "space" that the idea gets a more concrete meaning. On the surface of Earth the escape velocity is about 11 kilometres per second. However, at 9000 km from the surface in "space," it is slightly less than 7.1 km/s. Continual acceleration from the surface to attain that speed at that height is possible. At no time would the "escape velocity" of 11 km/s be attained; yet at that height, even with zero propulsion now, the object can move away from Earth indefinitely.
For a simple case of escape velocity from a single body, escape velocity can be calculated as follows: