Actually An electric motor converts electrical energy into mechanical energy.
Most electric motors operate through interacting magnetic fields and current-carrying conductors to generate force. The reverse process, producing electrical energy from mechanical energy, is done by generators such as an alternator or a dynamo. Many types of electric motors can be run as generators and vice versa. For example, a starter/generator for a gas turbine or traction motors used on vehicles often perform both tasks. Electric motors and generators are commonly referred to as electric machines.