The half-reaction in a standard hydrogen electrode is as follows:

H+(aq)  +  e  →  ½ H2(g)                                 ν  =  1

and the reaction quotientQ , is given by

fH2 is the fugacity of hydrogen gas; fugacity has units of pressure and is the gas-phase analogue of activity – see here. For the standard hydrogen electrode,  fH2  =  Pº by definition). Note also, for the SHE,  Eº  =  0.
Substituting these results into the Nernst equation, we obtain

This equation tells us that for every increase in pH of one unit, the potential of a hydrogen electrode decreases by  RT ln10 / F  ( ≈ 59.2mV at 298 K.) The Nernst equation has thus given us the pH dependence of any reaction involving hydrogen ions.

In principle, therefore, the measurement of the pH of a solution is simple, being based upon the measurement of the potential of a hydrogen electrode immersed in the solution. The left-hand electrode of the cell must, of necessity, have been calibrated against an electrode of known potential (typically a SHE) so that it may be used a reference.

The cell potential may be measured with a voltmeter, and knowing the potential of the reference electrode the potential of the hydrogen electrode may be calculated. The pH of the solution may then be obtained from the equation above.

An electrode commonly used as a reference is a saturated calomel electrode. It consists of mercury in contact with a solution of potassium chloride saturated with Hg2Cl2:

Hg2Cl2(s)  +  2e → 2Hg(l)  +  Cl(aq)                         Eº =  + 0.27 VThe half-reaction at a calomel electrode is

Note that whatever electrode is used as a reference, ultimately the calibration will be relative to a standard hydrogen electrode.

i.e. though it is always possible to calibrate an electrode against another electrode of known potential, there must come a point where an electrode potential was measured against a standard hydrogen electrode, as this is the only electrode with a potential that can be “known” (being defined as zero) without a prior measurement.

In practice, due to the inconvenience of handling a SHE, measurements are often made indirectly, using an electrode that has been calibrated against a SHE at different pH values.