In the standard model, custodial symmetry is violated by the hypercharge U(1) gauge interactions and the Yukawa couplings, while being preserved by the Higgs scalar potential. In the two-Higgs-doublet model (2HDM), the generic scalar potential introduces new sources of custodial symmetry breaking. We obtain a basis-independent expression for the constraints that impose custodial symmetry on the 2HDM scalar potential. These constraints impose CP-conservation on the scalar potential and vacuum, and in addition add one extra constraint on the scalar potential parameters. We clarify the mass degeneracies of the 2HDM that arise as a consequence of the custodial symmetry. We also provide a computation of the oblique parameters (S, T, and U) for the most general CP-violating 2HDM in the basis-independent formalism. We demonstrate that the 2HDM contributions to T and U vanish in the custodial symmetry limit, as expected. Using the experimental bounds on S and T from precision electroweak data, we examine the resulting constraints on the general 2HDM parameter space.