There are two easy ways to create a magnet. Firstly, you can make a permanent magnet like the ones you get on your refrigerator by exposing a ferromagnetic material such as iron to an external magnetic field. Inside ferromagnetic materials, atoms stick together in groups called domains. Within each domain, atoms are aligned in the same way, making the domain act just like a tiny bar magnet. In an ordinary chunk of iron, these domains point in different directions, essentially cancelling out each other’s effects. But under the influence of a magnetic field, they line up together, forming a permanent magnet. Alternatively, you can make an electromagnet by winding a coil of wire around a core (usually made of iron). When an electric current runs through this wire, it creates a magnetic field around the core, turning it into a magnet.
Answered by Alex Cheung