Permanent magnets differ from electromagnets. Electricity passes through coils of wire in electromagnets. An electromagnet behaves like a magnet when it has electric current flowing through its coils, which creates magnetic fields. Electronic devices often use electromagnets when magnetic forces are only applied for a short time.
Electromagnets work by creating a magnetic field around a wire as electricity flows through it. By Fleming's right-hand rule, if the thumb, first finger, and second finger are perpendicular to each other (right angle), the thumb represents magnetic thrust, the first finger represents a moving particle, and the second finger represents an induced magnetic field.
There are two names for this rule: dynamo rule or generator rule. The right-hand rule can be used to determine the magnetic field's direction. One wire produces a weak magnetic field. Wires are wrapped in loops to combine the magnetic fields of each to create an electromagnet with a stronger magnet.