Lepidopteran larvae demonstrate several remarkable specialisations of the alimentary canal: the most active epithelial transport known; a unique cell type, called a goblet cell; and the highest pH values known to be generated by a biological system. The electrogenic K+ pump in midgut is now known to be energised by a H+-pumping V-ATPase, and net alkali metal transport is achieved by linking it to a nH+/alkali metal exchanger, which recycles H+ into the cytoplasm. Generation of high luminal pH is modelled as a passive (Nernstian) distribution of protons in the electrical field generated by the V-type ATPase. Electrode impalements show that the potential difference across the goblet cavity membrane is extremely high. Measurements of pH gradients generated in vitro confirm that the midgut itself generates such a gradient, that this process relies on metabolic energy, and that the differential ability of midgut subregions to perform acid-base transport maps to their differing morphologies and to the pH profiles observed along the gut in vivo. During larval/larval moults, K+ transport is suppressed. The transepithelial potential difference (PD) across the gut collapses and recovers in phase with the loss and recovery of the gut pH gradient, and with tissue V-ATPase activity, confirming that these processes are intimately linked. Acridine Orange partitions into acidic compartments and might be expected to be concentrated in goblet cavities, as these are the compartments toward which the V-ATPase pumps protons. However, under normal conditions, Acridine Orange is excluded from the cavities. Red metachromasia of the cavities (implying low pH) is only observed when the ion transport status of the tissue is compromised. It thus seems likely that, under physiological conditions, K+/H+ exchange is tight enough to produce a neutral or alkaline, rather than acidic, cavity. Molecular analysis of the 16 000 Mr subunit from Manduca midgut reveals it to be closely similar to other known 16 000 Mr sequences, particularly that from Drosophila brain. It is thus likely to be a true H+ channel, rather than one modified for K+ transport. The cavity can be modelled in two ways: (i) to isolate the site of proton equilibration electrically from the main gut lumen, and thus allow larger pH gradients to develop, or (ii) to buffer the V-ATPase from the alkaline pH in the gut lumen, which would otherwise destroy the gradient driving the exchange of H+ for alkali metal cations. The first model would predict a high cavity pH, whereas the second would predict a near neutral pH and would imply a non-cavity route for transport of base equivalents. Work with both pH-sensitive dyes and pH-sensitive electrodes so far tends to support the second model.