A transformer transfers electrical energy from one circuit to another by changing the voltage and current levels using electromagnetic induction. It has two windings, a primary and secondary, wrapped around an iron core. When an alternating current is passed through the primary winding, it creates an alternating magnetic flux that induces an electromotive force in the secondary winding. The ratio of the number of turns in the primary and secondary determines whether the voltage is stepped up or down. Transformers are used to transmit power over long distances by increasing the voltage to reduce transmission losses before stepping it back down for distribution.