The macrocyclic host cucurbit[7]uril forms very stable complexes with the diprotonated (K-CB[7](1) = 1.8 x 10(8) dm(3) mol(-1)), monoprotonated (K-CB[7](2) = 1.0 x 10(7) dm(3) mol(-1)), and neutral ( K-CB[7](3) = 1.2 x 10(3) dm(3) mol(-1)) forms of the histamine H-2-receptor antagonist ranitidine in aqueous solution. The complexation behaviour was investigated using H-1 NMR and UV-visible spectroscopy as a function of pH and the pK(a) values of the guest were observed to increase (Delta pK(a1) = 1.5 and Delta pK(a2) = 1.6) upon host-guest complex formation. The energy-minimized structures of the host-guest complexes with the cationic guests were determined and provide agreement with the NMR results indicating the location of the CB[7] over the central portion of the guest. The inclusion of the monoprotonated form of ranitidine slows the normally rapid (E)-(Z) exchange process and generates a preference for the (Z) isomer. The formation of the CB[7] host-guest complex greatly increases the thermal stability of ranitidine in acidic aqueous solution at 50 degrees C, but has no effect on its photochemical reactivity.