Electric motors and generators operate based on the principles of electromagnetic induction. Motors convert electrical energy to mechanical motion, while generators convert mechanical motion to electrical energy. They both work by using magnetic fields to exert forces on electric currents or moving charges. The direction of these forces causes rotation, which is then harnessed to power other devices or generate electricity from mechanical inputs. Back electromotive force (EMF) is induced any time a coil moves through a magnetic field, and it ensures the conservation of energy as devices switch between motor and generator functions. However, real-world motors and generators have various inefficiencies that reduce their performance below the theoretical maximum.