This is described by the Henderson-Hasselbalch equation.
Artigo principal: Ecuación de Henderson-Hasselbalch.