We present a 3D gravity inversion technique, based on the Marquardt algorithm, to analyze gravity anomalies attributable to basement interfaces above which the density contrast varies continuously with depth. The salient feature of this inversion is that the initial depth of the basement is not a required input. The proposed inversion simultaneously estimates the depth of the basement interface and the regional gravity background. Applicability and efficacy of the inversion is demonstrated with a synthetic model of a density interface. We analyze the synthetic gravity anomalies (1) solely because of the structure, (2) in the presence of a regional gravity background, and (3) in the presence of both random noise and regional gravity background. The inverted structure remains more or less the same, regardless of whether the regional background is simulated with a second-degree polynomial or a bilinear equation. The depth of the structure and estimated regional background deviate only modestly from the assumed ones in the presence of random noise and regional background. The analyses of two sets of real field data, one over the Chintalpudi subbasin, India, and another over the Pannonian basin, eastern Austria, yield geologically plausible models with the estimated depths that compare well with drilling data.