Carbon is subducted to depths where metamorphism liberates water-bearing fluids. The C-bearing fluids facilitate partial melting of the upper mantle, generating magmas that may erupt as arc volcanics. Degassing of the magmas releases CO2and other volatile species to the atmosphere. Over geological time, this process contributes to the composition of the atmosphere and planetary habitability. Here I summarize the background needed to carry out theoretical geochemical modelling of fluids and fluid–rock interactions from surficial conditions into the upper mantle. A description of the general criteria for predicting equilibrium and non-equilibrium chemical reactions is followed by a summary of how the thermodynamic activities of species are related to measurable concentrations through standard states and activity coefficients. Specific examples at ambient conditions involving dilute water are detailed. The concept of aqueous speciation and how it can be calculated arises from this discussion. Next, I discuss how to calculate standard Gibbs free energies and aqueous activity coefficients at elevated temperatures and pressures. The revised Helgeson–Kirkham–Flowers equations of state are summarized and the revised predictive correlations for the estimation of equation of state coefficients in the Deep Earth Water (DEW) model are presented. Finally, the DEW model is applied to the solubility and speciation of aqueous aluminium.