A generator is a device that converts mechanical energy into electrical energy. It typically consists of a coil of wire rotating within a magnetic field, which induces an electric current in the wire. Generators are commonly used to provide backup power during outages or in remote locations where electrical power is not readily available.