A transformer is a device that converts alternating voltages from one level to another. It works on the principle of mutual induction, where a changing magnetic field in one coil induces a voltage in a nearby coil. A transformer has two coils, a primary coil that receives the incoming voltage and a secondary coil that outputs the transformed voltage. The ratio of the number of turns in the secondary coil to the number of turns in the primary coil determines whether the transformer steps up or steps down the voltage. Transformers are commonly used to increase or decrease voltages for applications like power transmission, welding equipment, and electronics.