It can be very informative to acquire NMR spectra of a sample as a function of the solution pH. Examples can be found in the design of host–guest complexes or in the determination of the pKa values of organic molecules. In the conventional procedure, a series of spectra must be recorded and the pH of the sample adjusted manually between successive NMR measurements. As an alternative to this laborious procedure, we demonstrate how controlled pH gradients may be established in 5 mm NMR tubes and analyzed using standard NMR equipment in a “single shot” experiment. Using 1H NMR imaging techniques and a set of NMR pH indicator compounds, we are able to measure the pH of a sample as a function of position along a pH gradient. We are thus able to obtain the necessary set of 1H NMR spectra as a function of pH from a single sample in a single NMR experiment. As proof of concept, we demonstrate how the technique may be employed for the determination of the pKa values of small organic molecules. We are able to measure pKa values from 1 to 11 to within 0.1 units of their literature values. The method is robust to variations in the setting of the pH gradients and can be readily implemented through an automated sample changer.