A transformer is a device for changing the voltage of an alternating current. An alternating current is one that flow back and forth, reversing its direction. A transformer consists of at least two sets of insulated coil windings on a soft iron core. The core is not a solid bar, but is constructed of many layers of thin iron called laminations. The coil connected to input voltage is called primary coil and the coil connected to to the output voltage is called the secondary coil.
When an alternating current is applied to the primary coil, electrical energy from primary coil is transferred to the secondary coil through the changing magnetic field.In other words when an alternating current is applied to the primary coil, it generates a magnetic field in the iron core, the changing magnetic field in the primary coil then induces an EMF in secondary coil which then produce electrical energy in the secondary coil.
The outout voltage depends on the input voltage and the number of turns of the primary coil and secondary coil on the iron core.