The pH scale is estimated from the concentration of hydrogen ions.
pH = - log [H+]
For strong acids and bases, [H+] can be directly derived from the concentration of the acid or base.
For weak acids and bases, the [H+] needs to be calculated from the Ka
Ka = ( [H+] [A¯] ) / [HA]
For buffers, the pH can be calculated using the Henderson-Hasselbalch equation.