A calculator that shows its working

pH calculator

Pick what you dissolve and how much. The exact pH comes from the charge balance; the textbook shortcut sits beside it, so you can see when it lies.

6 min read · 2 interactive figures · 1 question

Choose a strong acid or base, a weak acid or base, or a buffer, then set the concentration with the slider or type it exactly. The solid pointer is the exact equilibrium pH; the hollow one is the textbook shortcut for that case. The bar shows how the dissolved acid is shared between its forms. Everything is at 25 °C, with concentrations standing in for activities; a Davies activity estimate is computed too, and a warning appears whenever it differs from the ideal pH by 0.05 or more.

To calculate the pH of a solution, find its hydrogen-ion concentration [H⁺] in moles per liter and take pH = −log10[H⁺]. For 0.1 M hydrochloric acid that is immediate: [H⁺] = 0.1 M, pH 1.00. For everything else, [H⁺] is not something you put in the bottle. It is what is left after the acid, the base and water have finished trading protons, and the calculator above finds it exactly by balancing the charges.

Most textbooks give a different shortcut formula for each kind of solution. They are good approximations most of the time, and each fails in a predictable place. This page lists them, shows where each one breaks, and explains the single method that never does. The chapter on the pH scale explains what the number means; this page is about getting it right.

One method for every solution

Every solution in water is electrically neutral: the positive charges add up to the negative ones. That one fact, together with the equilibrium constants, is enough to fix [H⁺]. For a weak acid HA at concentration C, the only ions are H⁺, OH⁻ and A⁻, so

[H⁺] = [OH⁻] + [A⁻] = Kw[H⁺] + C KaKa + [H⁺](6.1)

The second form uses two facts from Chapter 2: water’s ion product Kw = [H⁺][OH⁻], and the fraction of the acid that has lost its proton, Ka/(Ka + [H⁺]). Equation (6.1) has one unknown and exactly one positive solution[1]. established A computer finds it by bisection in a few dozen steps: guess a pH, see whether the positive or the negative side of the balance is bigger, and halve the interval. Add sodium ions for a salt, a second acid for a mixture, or more terms for an acid with several protons, and the method does not change. That is what the calculator does, and what every figure on this site does.

The shortcut formulas, and where they fail

The shortcuts come from dropping terms in equation (6.1) that are usually small; analytical chemistry textbooks derive each one this way[4]. Each is safe as long as the term it drops really is small.

SolutionShortcutDroppedFails when
Strong acid, CpH = −log Cwater’s own H⁺C below about 10⁻⁶ M
Strong base, CpH = pKw + log Cwater’s own OH⁻C below about 10⁻⁶ M
Weak acidpH = ½(pKa − log C)the acid used up; watermore than ~5 % dissociated, or pH near 7
Weak basepOH = ½(pKb − log C)the base used up; waterthe same, mirrored
BufferpH = pKa + log([A⁻]/[HA])exchange with waterdilute, extreme ratio, or pKa near 0 or 14

The classic trap is the first row. Dilute hydrochloric acid to 10⁻⁸ M and the formula gives pH 8: an acid that is basic. The exact answer is 6.98, because water’s own 10⁻⁷ M of H⁺ now outweighs the acid’s 10⁻⁸ M[1]. established Type 1e-8 into the calculator with “a strong acid” and watch the two pointers part.

Figure 1 Hydrochloric acid diluted tenfold at a time, starting from 0.1 M. The dashed line is the shortcut pH = −log C; the solid line is the exact charge balance. Drag along the curve or use the slider: the two agree down to 10⁻⁶ M and then part, the shortcut heading on toward pH 8 and beyond while the exact pH settles at 7. Tick the box to dilute acetic acid the same way.#

The figure shows why. Each tenfold dilution takes away nine-tenths of the acid’s hydrogen ions, but water keeps supplying its own, about 10⁻⁷ M. Once the acid’s contribution falls to that level the two are comparable, and below it water wins: no amount of dilution can make an acid basic.

Question 1 Prediction: a salt in water.#

The weak-acid shortcut, √(KaC) in disguise, is excellent for 0.1 M acetic acid (2.878 against an exact 2.881) and poor for acids that are either fairly strong or very dilute. At 10⁻⁴ M acetic acid it is off by 0.09, because a third of the acid has dissociated and “x ≪ C” no longer holds. For the hydrogen sulfate ion at 0.01 M it is off by 0.21. For 0.1 M phosphoric acid, whose first pKa is 2.15, it gives 1.57 against an exact 1.63. illustrative The quadratic formula repairs the first failure; only the full balance, with water in it, repairs both.

Worked examples

Each of these is one setting of the calculator. The values are exact solutions of the charge balance at 25 °C, using the thermodynamic pKa values tabulated by Goldberg, Kishore and Lennen[5].

SolutionExact pHShortcut
0.1 M HCl1.001.00
10⁻⁸ M HCl6.988.00
0.01 M NaOH11.9911.99
0.1 M acetic acid2.882.88
10⁻⁴ M acetic acid4.474.38
0.1 M sodium acetate8.888.88
0.1 M ammonia11.1211.12
0.1 M ammonium chloride5.125.12
0.1 M phosphoric acid1.631.57
0.01 M sodium hydrogen sulfate2.211.99

The pattern is worth remembering. The shortcuts are reliable for ordinary concentrations of genuinely weak acids and bases, and for strong ones above about a micromolar. They fail for acids with a pKa near or below 2, which are too strong for “barely dissociated” to hold, and for anything so dilute that water’s own ions compete. For buffers, the map in Chapter 4 shows the same boundary for the Henderson–Hasselbalch equation, and the calculator’s buffer setting lets you test any mixture against it.

What the buffer capacity readout means

Below the ruler the calculator also reports β, the solution’s buffer capacity: how many moles of strong base per liter it would take to raise the pH by one unit, at this pH. Pure water at pH 7 has a β of about 5 × 10⁻⁷ M per pH, which is why one drop of acid moves it so far. A 0.1 M acetate buffer at its pKa has 0.058, more than a hundred thousand times as much. Two solutions with the same pH can differ enormously in how hard they are to move, and β is the number that says so.