Permanent magnets require special manufacturing techniques in a magnetic field to get the metal to stay in the proper alignment. In order to demagnetize a magnet, you can change this alignment in a number of different ways. This process usually requires a high amount of heat, or a strong magnetic field at a reverse polarity to the magnet you want to demagnetize.
Change the Magnet with High Heat
Heating a magnet causes the electrons inside to spin and generally move to higher energy states, which makes them end up in a position that’s opposed to other electrons nearby. Because of this the electrons are no longer as well lined up, so the magnetism of the whole object decreases. Eventually whole regions of the magnet fail to be lined up properly and the magnet is demagnetized. The temperature at which this happens is called the Curie temperature. This temperature depends on the materials in the magnet and could be as high as 1390 degrees Fahrenheit (770 degrees Celsius) for low carbon steel, for example.
Place the Magnet in a Reverse Field
You can also remove the magnetic property of a magnet by placing it in a reversed magnetizing field. This will oppose the object’s magnetism. You can do this by passing an alternating current through a component of the magnet. This is how demagnetizing tools work.
Hammer the Magnet
If you hit the magnet in such a way as to destroy its north and south pole alignment, it will often lose its magnetic properties. The sections inside the magnet can lose their magnetic properties if they are forced out of alignment, and any violent means could theoretically make this happen, including drilling the magnet or hitting it with a pickaxe or other tool that can induce physical trauma on an object. If the grains inside of the magnet no longer line up properly, it will no longer function, just like what happens when the magnet is subjected to a high level of heat.
Leave the Magnet Alone for a Long Time
Any amount of heat can cause a magnet to lose its magnetic properties. A smaller amount of heat, such as at room temperature, will have this effect over a much longer time period. For example, for a simple flat magnet to lose its magnetic property, it would take an amount of time greater than a human life time.