What is the principle of an electric generator?

An electric generator is based on the phenomenon of electromagnetic induction. In an electric generator, mechanical energy is converted to electrical energy.
The principle of electromagnetic induction states that whenever there is relative motion between a coil and the magnetic field around it, an emf is produced in the coil.