A computer program has been developed for three-dimensional analysis of total field magnetic anomalies due to arbitrary polarization suitable for present-day personal computers. A vertical sided prism with arbitrary polarization is used as a basic model. A nonlinear optimization technique based on Marquardt's algorithm is used to estimate all parameters of the model. A combination of prisms is used to analyze more complex magnetic fields. Analytical methods are used to estimate the derivatives required in the simultaneous solutions of the normal equations. Methods have been developed to minimize the computing time in forward calculation as well as in inversion. Approximate equations have been derived for rapid calculation of magnetic anomalies and partial derivatives of anomalies of prismatic bodies, which are valid beyond short distances from the sources. The algorithm has been developed in such a way that the use of the exact and approximate equations may be efficiently monitored as a trade-off between accuracy and speed. The method is applied to analyze a synthetic anomaly contour map and the total field aeromagnetic anomalies in the offshore region of Mahanadi basin, Orissa, India.