The transesterification (alcoholysis) reaction was successfully applied to synthesize biodiesel from vegetable oils using imidazolium-based ionic liquids under multiphase acidic and basic conditions. Under basic conditions, the combination of the ionic liquid 1-n-butyl-3-methylimidazolium bis(trifluoromethylsulfonyl)imide (BMI⋅NTf2), alcohols, and K2CO3 (40 mol %) results in the production of biodiesel from soybean oil in high yields (>98 %) and purity. H2SO4 immobilized in BMI⋅NTf2 efficiently promotes the transesterification reaction of soybean oil and various primary and secondary alcohols. In this multiphase process the acid is almost completely retained in the ionic liquid phase, while the biodiesel forms a separate phase. The recovered ionic liquid containing the acid could be reused at least six times without any significant loss in the biodiesel yield or selectivity. In both catalytic processes (acid and base), the reactions proceed as typical multiphasic systems in which the formed biodiesel accumulates as the upper phase and the glycerol by-product is selectively captured by the alcohol-ionic liquid-acid/base phase. Classical ionic liquids such as 1-n-butyl-3-methylimidazolium tetrafluoroborate and hexafluorophosphate are not stable under these acidic or basic conditions and decompose.