A global particle swarm optimization (GPSO) technique is developed and applied to the inversion of residual gravity anomalies caused by buried bodies with simple geometry (spheres, horizontal, and vertical cylinders). Inversion parameters, such as density contrast of geometries, radius of body, depth of body, location of anomaly, and shape factor, were optimized. The GPSO algorithm was tested on noise-free synthetic data, synthetic data with 10% Gaussian noise, and five field examples from different parts of the world. The present study shows that the GPSO method is able to determine all the model parameters accurately even when shape factor is allowed to change in the optimization problem. However, the shape was fixed a priori in order to obtain the most consistent appraisal of various model parameters. For synthetic data without noise or with 10% Gaussian noise, estimates of different parameters were very close to the actual model parameters. For the field examples, the inversion results showed excellent agreement with results from previous studies that used other inverse techniques. The computation time for the GPSO procedure is very short (less than 1 s) for a swarm size of less than 50. The advantage of the GPSO method is that it is extremely fast and does not require assumptions about the shape of the source of the residual gravity anomaly.