Preparing a Buffer for a Target pH
A buffer made from a weak acid HA and its conjugate base A⁻ (or a weak base B and its conjugate acid BH⁺)
satisfies the Henderson–Hasselbalch relation. For acid buffers:
\[
\begin{aligned}
\mathrm{pH} &= \mathrm{p}K_a + \log\!\frac{[A^-]}{[HA]} \\
\Rightarrow\quad [A^-] &= [HA]\;10^{\mathrm{pH}-\mathrm{p}K_a}.
\end{aligned}
\]
For base buffers, use \(\mathrm{p}K_a = 14 - \mathrm{p}K_b\) of the conjugate acid and
\(\displaystyle \mathrm{pH} = \mathrm{p}K_a + \log\!\frac{[B]}{[BH^+]}\), so
\(\displaystyle [BH^+] = [B]\;10^{-(\mathrm{pH}-\mathrm{p}K_a)}\).
From concentration to mass
Once the required conjugate concentration is known, multiply by the final volume \(V\) to get
the moles of salt to dissolve, then multiply by its molar mass \(M\):
\[
\begin{aligned}
n_{\text{salt}} &= [\text{conjugate}]\,V, \\
m_{\text{salt}} &= n_{\text{salt}}\,M.
\end{aligned}
\]
Why Henderson–Hasselbalch works here
In typical buffer preparations, the salt provides most of the conjugate species. The weak
acid/base ionization (\(x\)) is small compared with the stoichiometric concentrations,
so the equilibrium concentrations are well approximated by the initial ones. A quick
check with the exact equilibrium expression confirms the obtained pH:
\[
\begin{aligned}
K_a &= \frac{[A^-][H_3O^+]}{[HA]}
\;=\; \frac{x\,(C_{\text{conj}}+x)}{C_{\text{weak}}-x}
\quad\Rightarrow\quad
x = \frac{-\big(C_{\text{conj}}+K_a\big)+\sqrt{\big(C_{\text{conj}}+K_a\big)^2+4K_aC_{\text{weak}}}}{2}.
\end{aligned}
\]
Here \(x=[H_3O^+]\) for acid buffers (or \(x=[OH^-]\) for base buffers). The resulting
\(\mathrm{pH}=-\log_{10}x\) should closely match the target value when buffer assumptions hold.
Notes: (1) This tool assumes 1:1 salts (e.g., NaA, BH⁺Cl⁻) and that volume change upon dissolution is negligible.
(2) For very dilute buffers or extreme pH targets, verify assumptions with the equilibrium check.