Electroreduction of carbon dioxide (CO ) into high value-added products is a potential solution to a reduction in CO levels and its utilization. One major challenge is the lack of an efficient system that can highly selectively reduce CO into desirable products with low energy consumption. Ionic liquids (ILs) have been used as electrolytes for the electroreduction of CO , and it has been proven that the CO -cation complex results in a low-energy pathway. In this work, an ionic microhabitat (IMH) has been built for CO electroreduction, and a novel anion-functionalized IL, 1-butyl-3-methylimidazolium 1,2,4triazolide ([Bmim][124Triz]), has been designed as the reaction medium. The results showed that the IMH played a key role in enhancing the performance of CO electroreduction, especially in dominating the product selectivity, which is recognized to be a great challenge in an electroreduction process. New insights into the role of the IMH in higher CO solubility, bending linear CO by forming the [124Triz]-CO adduct, and transferring activated CO into the cathode surface easily were revealed. The Faradaic efficiency for formic acid is as high as 95.2 %, with a current density reaching 24.5 mA cm . This work provides a promising way for the design of robust and highly efficient ILs for CO electroreduction.