An electromagnet is a type of magnet that is created by passing an electric current through a coil of wire. The coil acts as a magnetic field when an electric current is passed through it, and becomes magnetic when the current flows. Electromagnets are used in a variety of applications, such as electric motors, MRI machines, and magnetic levitation trains.