An electromagnet is a coil of wire that produces a magnetic field when electric current passes through it. The magnetic field can be strengthened by using an iron core inside the coil or by increasing the amount of current or number of coils. Electromagnets are common components in electronic devices and generators produce electricity by moving a coil of wire within a magnetic field, with the electric current strength affected by the speed of coil movement and number of coils.