We investigate the effect of pressure, temperature and acidity on the composition of water-rich carbon-bearing fluids at thermodynamic conditions that correspond to the Earth's deep Crust and Upper Mantle. Our first-principles molecular dynamics simulations provide mechanistic insight into the hydration shell of carbon dioxide, bicarbonate and carbonate ions, and on the pathways of the acid/base reactions that convert these carbon species into one another in aqueous solutions. At temperature of 1000 K and higher our simulations can sample the chemical equilibrium of these acid/base reactions, thus allowing us to estimate the chemical composition of diluted carbon dioxide and (bi)carbonate ions as a function of acidity and thermodynamic conditions. We find that, especially at the highest temperature, the acidity of the solution is essential to determine the stability domain of CO2 vs HCO − 3 vs CO 2− 3 .