How does it work?
An acid donates a proton, a base accepts it
In water, an acid hands an H⁺ ion (a proton) to a water molecule — forming the hydronium ion H₃O⁺. A base does the opposite: it takes a proton from water and leaves an OH⁻ ion. The breakup of a substance into ions in water is called electrolytic dissociation. Strong acids (HCl, HNO₃, H₂SO₄ in its first step) and strong bases (NaOH, KOH) dissociate practically completely; weak ones (acetic acid, ammonia) only to a small extent.
pH = −log [H₃O⁺] pOH = −log [OH⁻]
Kw = [H₃O⁺]·[OH⁻] = 1.0·10⁻¹⁴ ⇒ pH + pOH = 14 at 25 °C
Dissociation constant of a weak acid
Ka = [H₃O⁺]·[A⁻][HA] [H₃O⁺] = −Ka + √(Ka² + 4·Ka·c)2
The smaller the constant Ka (the larger pKa = −log Ka), the weaker the acid. For acetic acid Ka = 1.8·10⁻⁵, so in a 0.1 mol/L solution only about 1 in 75 molecules is dissociated, and the pH is about 2.9 instead of 1.
Neutralization and titration
H₃O⁺ + OH⁻ → 2 H₂O ca·Va = cb·Vb for a 1 : 1 reaction
At the equivalence point the base has exactly neutralized the acid. The pH at this point is 7 only for a strong acid + strong base pair; the salt of a weak acid (CH₃COONa) makes the solution basic, and the salt of a weak base (NH₄Cl) makes it acidic. That's why the indicator is chosen so that it changes color within the pH jump.
Buffers
pH = pKa + log [A⁻][HA]
A buffer is a mixture of a weak acid and its salt (or a weak base and its salt). Added acid uses up A⁻, added base uses up HA — the concentration ratio barely changes, so the pH hardly moves. A buffer works best within pKa ± 1, until its capacity runs out.
Simplifications: we use concentrations instead of activities (in concentrated solutions the real pH differs a little), assume 25 °C and Kw = 10⁻¹⁴, and the indicator colors are approximate — real shades depend on indicator concentration and lighting.