An algorithm is proposed here for determining the optimum sequestration depth (in terms of depth corresponding to maximum net income per unit rock volume) in a saline formation for CO2 trapped by residual gas and solubility trapping mechanisms. The Peng–Robinson equation of state was used to determine the density and fugacity of sequestered CO2 and the compression energy required for CO2 injection. Geochemist’s Workbench®, a commercial geochemical software package, was used to estimate CO2 solubility in groundwater. Operational costs and CO2 emissions due to compression energy consumption were estimated. A hypothetical reference case was constructed to illustrate the proposed algorithm, assuming constant values of geothermal gradient, hydrostatic pressure gradient, sweep efficiency and initial groundwater chemistry, with a depth-dependent porosity and porosity-dependent saturation of residual gas. In general, the algorithm was illustrated successfully for the hypothetical reference case and produced the following results. The depth corresponding to maximum trapping capacity was approximately 3000 m, but the depth representing maximum net income was approximately 1300 m. CO2 emissions due to compression energy consumption per unit mass of CO2 sequestration cannot be ignored, but may be <0.15, even down to a depth of 7000 m. Both the trapping capacity and net income of CO2 sequestration decreased with geothermal gradient, but the corresponding optimum depths increased with geothermal gradient.