Magnets are typically classified into permanent and non-permanent magnets, despite both being magnetic and able to attract ferrous items, permanent and non-permanent magnets have different advantages and traits.
Magnets made from Neodymium (NdFeB), Samarium Cobalt (SmCo), and Ferrite are classed as permanent magnets, whereas electromagnets will be typically classed as non-permanent magnets.
A permanent magnet is a solid material that produces its own consistent magnetic field because the material is magnetised. However, unlike permanent magnets, the magnetic field produced by an electromagnet is produced by the flow of electric current and will disappear when the current is turned off.
However, an electromagnet typically consists of many turns of copper wire which form a solenoid, when an electric current flows around the solenoid coil, a magnetic field is created.
If an iron core is inserted into the bore of this solenoid, then magnetism is induced into it and it becomes magnetic, but when the current stops flowing it immediately becomes nonmagnetic.
Both permanent magnets and electromagnets have North and South Poles, and both will have their magnetic fields interact with other sources of magnetic fields and materials which exhibit magnetic properties.
Here’s a breakdown of the similarities and differences between permanent and electromagnets: