A transformer converts one voltage to another. It only works with alternating current, in which the direction of the electrical flow periodically changes.
The transformer is a sort of electrically-powered generator, arranged so that it has no moving parts. A transformer has at least two coils or windings. As current flows through the powered winding, or primary the winding produces a magnetic field that grows through the unpowered windings. As the magnetic field passes the unpowered winding(s), or secondaries it causes current to flow in them. As the current changes direction, the direction of the magnetic field and electric flow reverse, causing the same effect in reverse. The change of magnetic field causes the parts of the transformer to vibrate, which is why transformers hum.
The winding with less turns of wire has higher current, at lower voltages. The winding with more turns of wire has less current, at higher voltages. The ratio of voltage is proportional to the number of turns of wire. For example, a 5-to-1 step-down transformer might take 1200 volt 60 cycle alternating current, and change it to the 240 volt alternating current actually distributed to houses. It might have 500 turns of wire on the primary, and 100 turns on the secondary.
The high-current low-voltage windings have fewer turns of thicker wire. The thicker wire helps carry more current. The high-voltage, low current windings have more turns of thinner wire. The thinner wire carries less curent, but at a higher voltage.
Some transformers have equal numbers of windings on both coils. These "isolation" transformers are used to prevent direct current flow between electric circuits, while transferring power.
Small transformers are often used to isolate and link different parts of radios. See electronics and impedance match.
Some transformers are designed so that one winding turns or slides, while the other remains stationary. These can pass power or radio signals from a stationary mounting to a turning mechanism, such as a machine tool head or radar antenna.
Some moving transformers are precisely constructed, and used to measure distances. Most often, they have several primaries, and electronic ciruits measure the shape of the wave in the different secondaries.
Transformers often have silicon steel cores to channel the magnetic field. This keeps the field more concentrated around the wires, so that the transformer is more efficient. The core also keeps the field from being wasted in nearby pieces of metal.
Cores are often made of many stamped pieces of thin steel. This prevents eddy currents from forming in the cores, and wasting power by heating the core. Some cores are made of nonconductive magnetic materials, various chemically-pure compounds of rust called "ferrite."
Power transformers are usually more than 98% efficient. The higher voltage transformers are bathed in high-temperature stable oil, often polychlorinated biphenyls, the famous toxic waste, "PCB". The oil cools the transformer, and helps prevent shorts.