<p>Small amounts of an impurity may affect the key properties of an ionic liquid and such effects can be dramatically amplified when the electrolyte is under confinement. Here the classical density functional theory is employed to investigate the impurity effects on the microscopic structure and the performance of ionic-liquid-based electrical double-layer capacitors, also known as supercapacitors. Using a primitive model for ionic species, we study the effects of an impurity on the double layer structure and the integral capacitance of a room temperature ionic liquid in model electrode pores and find that an impurity strongly binding to the surface of a porous electrode can significantly alter the electric double layer structure and dampen the oscillatory dependence of the capacitance with the pore size of the electrode. Meanwhile, a strong affinity of the impurity with the ionic species affects the dependence of the integral capacitance on the pore size. Up to 30% increase in the integral capacitance can be achieved even at a very low impurity bulk concentration. By comparing with an ionic liquid mixture containing modified ionic species, we find that the cooperative effect of the bounded impurities is mainly responsible for the significant enhancement of the supercapacitor performance.</p