A generator is a machine that produces electricity. It converts mechanical energy into electrical energy by using a fuel source, such as gasoline or diesel, to turn a turbine or a magnet within a coil of wire. This movement creates a flow of electrons, generating an electric current. Generators are commonly used as backup power sources during blackouts or in remote areas without access to the power grid. They can also be used in industries, construction sites, and outdoor events where a temporary or portable source of electricity is needed.