Magnet
Rare earth (lanthanoid) elements have a partially occupied "f" electron shell (which can accommodate up to 14 electrons). The spin of these electrons can be aligned, resulting in very strong magnetic fields, and therefore, these elements are used in compact high-strength magnets where their higher price is not a concern. The most common types of rare-earth magnets are samarium-cobalt and neodymium-iron-boron (NIB) magnets.
Neodymium magnet
The neodymium atom also can have a large magnetic dipole moment because it has 4 unpaired electrons in its electron structure as opposed to (on average) 3 in iron. In a magnet it is the unpaired electrons, aligned so they spin in the same direction, which generate the magnetic field. This gives the NdFeB compound a high saturation magnetization ("J" ~1.6 T or 16 kG) and a remnant magnetization of typically 1.3 teslas. Therefore, as the maximum energy density is proportional to "J", this magnetic phase has the potential for storing large amounts of magnetic energy ("BH" ~ 512 kJ/m or 64 MG·Oe). This magnetic energy value is about 18 times greater than "ordinary" ferrite magnets by volume, and 12 times by mass. This magnetic energy property is higher in NdFeB alloys than in samarium cobalt (SmCo) magnets, which were the first type of rare-earth magnet to be commercialized. In practice, the magnetic properties of neodymium magnets depend on the alloy composition, microstructure, and manufacturing technique employed.