As you have seen in calculating the pH of solutions, only a small amount of a strong acid is necessary to drastically alter the pH. For certain experiments, however, it is desirable to keep a fairly constant pH while acids or bases are added to the solution either by reaction or by the experimenter. Buffers are designed to fill that role. Chemists use buffers routinely to moderate the pH of a reaction. Biology finds manifold uses for buffers which range from controlling blood pH to ensuring that urine does not reach painfully acidic levels.
A buffer is simply a mixture of a weak acid and its conjugate base or a weak base and its conjugate acid. Buffers work by reacting with any added acid or base to control the pH. For example, let's consider the action of a buffer composed of the weak base ammonia, NH3, and its conjugate acid, NH4+. When HCl is added to that buffer, the NH3 "soaks up" the acid's proton to become NH4+. Because that proton is locked up in the ammonium ion, it proton does not serve to significantly increase the pH of the solution. When NaOH is added to the same buffer, the ammonium ion donates a proton to the base to become ammonia and water. Here the buffer also serves to neutralize the base.
As the above example shows, a buffer works by replacing a strong acid or base with a weak one. The strong acid's proton is replaced by ammonium ion, a weak acid. The strong base OH- was replaced by the weak base ammonia. These replacements of strong acids and bases for weaker ones give buffers their extraordinary ability to moderate pH.
Buffers must be chosen for the appropriate pH range that they are called on to control. The pH range of a buffered solution is given by the Henderson- Hasselbalch equation. For the purpose of the derivation, we will imagine a buffer composed of an acid, HA, and its conjugate base, A-. We know that the acid dissociation constant pKa of the acid is given by this expression:
The equation can be rearranged as follows:
Taking the -log of this expression and rearranging the terms to make each one positive gives the Henderson-Hasselbalch equation: