Mechanism by which materials form into and are attracted to magnets
Ferromagnetism is a property of certain materials (such as iron) that results in a significant, observable magnetic permeability, and in many cases, a significant magnetic coercivity, allowing the material to form a permanent magnet. Ferromagnetic materials are noticeably attracted to a magnet, which is a consequence of their substantial magnetic permeability. 
Magnetic permeability describes the induced magnetization of a material due to the presence of an external magnetic field. For example, this temporary magnetization inside a steel plate accounts for the plate's attraction to a magnet. Whether or not that steel plate then acquires permanent magnetization depends on both the strength of the applied field and on the coercivity of that particular piece of steel (which varies with the steel's chemical composition and any heat treatment it may have undergone).
In physics, multiple types of material magnetism have been distinguished. Ferromagnetism (along with the similar effect ferrimagnetism) is the strongest type and is responsible for the common phenomenon of everyday magnetism. An example of a permanent magnet formed from a ferromagnetic material is a refrigerator magnet.
Substances respond weakly to three other types of magnetism—paramagnetism, diamagnetism, and antiferromagnetism—but the forces are usually so weak that they can be detected only by lab instruments. 
Permanent magnets (materials that can be magnetized by an external magnetic field and remain magnetized after the external field is removed) are either ferromagnetic or ferrimagnetic, as are the materials that are attracted to them. Relatively few materials are ferromagnetic. They are typically pure forms, alloys, or compounds of iron, cobalt, nickel, and certain rare-earth metals. 
Ferromagnetism is vital in industrial applications and modern technologies, forming the basis for electrical and electromechanical devices such as electromagnets, electric motors, generators, transformers, magnetic storage (including tape recorders and hard disks), and nondestructive testing of ferrous materials.
Ferromagnetic materials can be divided into magnetically soft materials (like annealed iron), which do not tend to stay magnetized, and magnetically hard materials, which do. Permanent magnets are made from hard ferromagnetic materials (such as alnico) and ferrimagnetic materials (such as ferrite) that are subjected to special processing in a strong magnetic field during manufacturing to align their internal microcrystalline structure, making them difficult to demagnetize. To demagnetize a saturated magnet, a magnetic field must be applied. The threshold at which demagnetization occurs depends on the coercivity of the material. Magnetically hard materials have high coercivity, whereas magnetically soft materials have low coercivity. 
The overall strength of a magnet is measured by its magnetic moment or, alternatively, its total magnetic flux. The local strength of magnetism in a material is measured by its magnetization.
Terms.
Historically, the term "ferromagnetism" was used for any material that could exhibit spontaneous magnetization: a net magnetic moment in the absence of an external magnetic field; that is, any material that could become a magnet. This definition is still in common use.
In a landmark paper in 1948, Louis Néel showed that two levels of magnetic alignment result in this behavior. One is ferromagnetism in the strict sense, where all the magnetic moments are aligned. The other is "ferrimagnetism", where some magnetic moments point in the opposite direction but have a smaller contribution, so spontaneous magnetization is present.
In the special case where the opposing moments balance completely, the alignment is known as "antiferromagnetism"; antiferromagnets do not have a spontaneous magnetization.
Materials.
Ferromagnetism is an unusual property that occurs in only a few substances. The common ones are the transition metals iron, nickel, and cobalt, as well as their alloys and alloys of rare-earth metals. It is a property not just of the chemical make-up of a material, but of its crystalline structure and microstructure. Ferromagnetism results from these materials having many unpaired electrons in their d-block (in the case of iron and its relatives) or f-block (in the case of the rare-earth metals), a result of Hund's rule of maximum multiplicity. There are ferromagnetic metal alloys whose constituents are not themselves ferromagnetic, called Heusler alloys, named after Fritz Heusler. Conversely, there are non-magnetic alloys, such as types of stainless steel, composed almost exclusively of ferromagnetic metals.
Amorphous (non-crystalline) ferromagnetic metallic alloys can be made by very rapid quenching (cooling) of an alloy. These have the advantage that their properties are nearly isotropic (not aligned along a crystal axis); this results in low coercivity, low hysteresis loss, high permeability, and high electrical resistivity. One such typical material is a transition metal-metalloid alloy, made from about 80% transition metal (usually Fe, Co, or Ni) and a metalloid component (B, C, Si, P, or Al) that lowers the melting point.
A relatively new class of exceptionally strong ferromagnetic materials are the rare-earth magnets. They contain lanthanide elements that are known for their ability to carry large magnetic moments in well-localized f-orbitals.
The table lists a selection of ferromagnetic and ferrimagnetic compounds, along with their Curie temperature ("T"C), above which they cease to exhibit spontaneous magnetization.
Unusual materials.
Most ferromagnetic materials are metals, since the conducting electrons are often responsible for mediating the ferromagnetic interactions. It is therefore a challenge to develop ferromagnetic insulators, especially multiferroic materials, which are both ferromagnetic and ferroelectric.
A number of actinide compounds are ferromagnets at room temperature or exhibit ferromagnetism upon cooling. PuP is a paramagnet with cubic symmetry at room temperature, but which undergoes a structural transition into a tetragonal state with ferromagnetic order when cooled below its "T"C = 125 K. In its ferromagnetic state, PuP's easy axis is in the ⟨100⟩ direction.
In NpFe2 the easy axis is ⟨111⟩. Above "T"C ≈ 500 K, NpFe2 is also paramagnetic and cubic. Cooling below the Curie temperature produces a rhombohedral distortion wherein the rhombohedral angle changes from 60° (cubic phase) to 60.53°. An alternate description of this distortion is to consider the length c along the unique trigonal axis (after the distortion has begun) and a as the distance in the plane perpendicular to c. In the cubic phase this reduces to . Below the Curie temperature, the lattice acquires a distortion
 formula_1
which is the largest strain in any actinide compound. NpNi2 undergoes a similar lattice distortion below "T"C 
 32 K, with a strain of (43 ± 5) × 10−4. NpCo2 is a ferrimagnet below 15 K.
In 2009, a team of MIT physicists demonstrated that a lithium gas cooled to less than one kelvin can exhibit ferromagnetism. The team cooled fermionic lithium-6 to less than 150 nK (150 billionths of one kelvin) using infrared laser cooling. This demonstration is the first time that ferromagnetism has been demonstrated in a gas.
In rare circumstances, ferromagnetism can be observed in compounds consisting of only s-block and p-block elements, such as rubidium sesquioxide.
In 2018, a team of University of Minnesota physicists demonstrated that body-centered tetragonal ruthenium exhibits ferromagnetism at room temperature.
Electrically induced ferromagnetism.
Recent research has shown evidence that ferromagnetism can be induced in some materials by an electric current or voltage. Antiferromagnetic LaMnO3 and SrCoO have been switched to be ferromagnetic by a current. In July 2020, scientists reported inducing ferromagnetism in the abundant diamagnetic material iron pyrite ("fool's gold") by an applied voltage. In these experiments, the ferromagnetism was limited to a thin surface layer.
Explanation.
The Bohr–Van Leeuwen theorem, discovered in the 1910s, showed that classical physics theories are unable to account for any form of material magnetism, including ferromagnetism; the explanation rather depends on the quantum mechanical description of atoms. Each of an atom's electrons has a magnetic moment according to its spin state, as described by quantum mechanics. The Pauli exclusion principle, also a consequence of quantum mechanics, restricts the occupancy of electrons' spin states in atomic orbitals, generally causing the magnetic moments from an atom's electrons to largely or completely cancel. An atom will have a "net" magnetic moment when that cancellation is incomplete.
Origin of atomic magnetism.
One of the fundamental properties of an electron (besides that it carries charge) is that it has a magnetic dipole moment, i.e., it behaves like a tiny magnet, producing a magnetic field. This dipole moment comes from a more fundamental property of the electron: its quantum mechanical spin. Due to its quantum nature, the spin of the electron can be in one of only two states, with the magnetic field either pointing "up" or "down" (for any choice of up and down). Electron spin in atoms is the main source of ferromagnetism, although there is also a contribution from the orbital angular momentum of the electron about the nucleus. When these magnetic dipoles in a piece of matter are aligned (point in the same direction), their individually tiny magnetic fields add together to create a much larger macroscopic field.
However, materials made of atoms with filled electron shells have a total dipole moment of zero: because the electrons all exist in pairs with opposite spin, every electron's magnetic moment is cancelled by the opposite moment of the second electron in the pair. Only atoms with partially filled shells (i.e., unpaired spins) can have a net magnetic moment, so ferromagnetism occurs only in materials with partially filled shells. Because of Hund's rules, the first few electrons in an otherwise unoccupied shell tend to have the same spin, thereby increasing the total dipole moment.
These unpaired dipoles (often called simply "spins", even though they also generally include orbital angular momentum) tend to align in parallel to an external magnetic field – leading to a macroscopic effect called paramagnetism. In ferromagnetism, however, the magnetic interaction between neighboring atoms' magnetic dipoles is strong enough that they align with "each other" regardless of any applied field, resulting in the spontaneous magnetization of so-called domains. This results in the large observed magnetic permeability of ferromagnetics, and the ability of magnetically hard materials to form permanent magnets.
Exchange interaction.
When two nearby atoms have unpaired electrons, whether the electron spins are parallel or antiparallel affects whether the electrons can share the same orbit as a result of the quantum mechanical effect called the exchange interaction. This in turn affects the electron location and the Coulomb (electrostatic) interaction and thus the energy difference between these states.
The exchange interaction is related to the Pauli exclusion principle, which says that two electrons with the same spin cannot also be in the same spatial state (orbital). This is a consequence of the spin–statistics theorem and that electrons are fermions. Therefore, under certain conditions, when the orbitals of the unpaired outer valence electrons from adjacent atoms overlap, the distributions of their electric charge in space are farther apart when the electrons have parallel spins than when they have opposite spins. This reduces the electrostatic energy of the electrons when their spins are parallel compared to their energy when the spins are antiparallel, so the parallel-spin state is more stable. This difference in energy is called the exchange energy. In simple terms, the outer electrons of adjacent atoms, which repel each other, can move further apart by aligning their spins in parallel, so the spins of these electrons tend to line up.
This energy difference can be orders of magnitude larger than the energy differences associated with the magnetic dipole–dipole interaction due to dipole orientation, which tends to align the dipoles antiparallel. In certain doped semiconductor oxides, RKKY interactions have been shown to bring about periodic longer-range magnetic interactions, a phenomenon of significance in the study of spintronic materials.
The materials in which the exchange interaction is much stronger than the competing dipole–dipole interaction are frequently called "magnetic materials". For instance, in iron (Fe) the exchange force is about 1,000 times stronger than the dipole interaction. Therefore, below the Curie temperature, virtually all of the dipoles in a ferromagnetic material will be aligned. In addition to ferromagnetism, the exchange interaction is also responsible for the other types of spontaneous ordering of atomic magnetic moments occurring in magnetic solids: antiferromagnetism and ferrimagnetism. There are different exchange interaction mechanisms which create the magnetism in different ferromagnetic, ferrimagnetic, and antiferromagnetic substances—these mechanisms include direct exchange, RKKY exchange, double exchange, and superexchange.
Magnetic anisotropy.
Although the exchange interaction keeps spins aligned, it does not align them in a particular direction. Without magnetic anisotropy, the spins in a magnet randomly change direction in response to thermal fluctuations, and the magnet is superparamagnetic. There are several kinds of magnetic anisotropy, the most common of which is magnetocrystalline anisotropy. This is a dependence of the energy on the direction of magnetization relative to the crystallographic lattice. Another common source of anisotropy, inverse magnetostriction, is induced by internal strains. Single-domain magnets also can have