The Diels-Alder reaction between cyclopentadiene and methyl acrylate in ionic liquids has been studied in detail. The effect of contamination of the ionic liquids by common impurities, viz. sodium and chloride ions, and water, on the selectivity has been investigated. The presence of high concentrations of chloride was found to decrease the selectivity. Anion and, in particular, cation effects have been investigated using an extensive series of air-stable room temperature ionic liquids, and kinetic parameters have been determined. It has been found that strongly interacting groups, particularly electrophilic moieties on the cation, accelerate the formation of the endo products. Substrate solubility intimately connected to the selectivity was found to be mainly anion dependent. An NMR-based solvent parameter scale and semi-empirical models are used to analyse the results and provide a tool for the prediction of selectivities in ionic liquids.