When an intramolecular cavity exists in a molecule, it can trap another chemical species to form a host–guest complex. We examine the formation of such an inclusion complex with cucurbit[n]uril (CBn, n = 6, 7) as the host to trap alkali metal or ammonium ions as the guest, by electrospray ionization mass spectrometry (ESI-MS). The results show that the inclusion complexes are formed between the three-dimensional cylinder of CBn hosts and the guest cations. Selectivity of the complex formation is dependent both on (1) ion–dipole interactions between the cylindrical portal of the CBn hosts and the guest cations and (2) the hydrophobic interactions at the inner cavity of CBn. Copyright © 2006 John Wiley & Sons, Ltd.