Abstract: CO2 is selectively hydrogenated to HCO2H or hydrocarbons (HCs) by RuFe nanoparticles (NPs) in ionic liquids (ILs) under mild reaction conditions. The generation of HCO2H occurs in ILs containing basic anions, whereas heavy HCs (up to C21 at 150 °C) are formed in the presence of ILs containing nonbasic anions. Remarkably, high values of TONs (400) and a TOF value of 23.52 h?1 for formic acid with a molar ratio of 2.03 per BMI·OAc IL were obtained. Moreover, these NPs exhibited outstanding abilities in the formation of long-chain HCs with efficient catalytic activity (12% conversion) in a BMI·NTf2 hydrophobic IL. The IL forms a cage around the NPs that controls the diffusion/residence time of the substrates, intermediates, and products. The distinct CO2 hydrogenation pathways (HCO2H or FT via RWGS) catalyzed by the RuFe alloy are directly related to the basicity and hydrophobicity of the IL ion pair (mainly imposed by the anion) and the composition of the metal alloy. The presence of Fe in the RuFe alloy provides enhanced catalytic performance via a metal dilution effect for the formation of HCO2H and via a synergistic effect for the generation of heavy HCs.