Do magnets ever lose their magnetism?

It depends on a bunch of factors like the type of magnetic material, the temperature, and whether it's stored with a "keeper" of easily magnetizable material that creates a magnetic circuit.

A bar magnet out in the open tends to be in a metastable state. Magnetic field lines go in circles, but they don't "like" to go through air and and other non-magnetic materials, so this creates Magnetic reluctance which tends to demagnetize the magnet. Good magnetic materials have high Coercivity which means they resist the demagnetizing, but this decreases with temperature and disappears entirely at the Curie temperature. If you complete a Magnetic circuit using either more high coercivity material magnetized in the same direction (in a loop), or more low-coercivity, high-susceptibility material such as soft iron (which happily picks up magnetism so as to create a loop), the demagnetizing is much less.

However potentially it can last a very long time: hundreds of millions of years. Igneous rocks that have not been reheated often contain a record of the earth's magnetism frozen in at the time they were formed. In conjunction with the fact that there have been Geomagnetic reversals at irregular intervals, this can be used as a method of dating rocks, and was key to establishing Seafloor spreading, which is part of the modern theory of Continental drift

Previous:What type of metals attract to magnets?

Next:What happens when you place an iron plate near that magnet?