A transformer works by transferring electrical energy between two or more coils through electromagnetic induction. When alternating current (AC) flows through the primary coil, it creates a magnetic field that induces a voltage in the secondary coil. The voltage change depends on the turns ratio of the coils; if the secondary coil has more turns, the voltage increases (step-up transformer), and if it has fewer turns, the voltage decreases (step-down transformer). This process efficiently transmits power across distances.