The magnetic force is created by the movement of electrons within the atoms of the magnet. When electrons move, they create a magnetic field. The magnetic field exerts a force on any other magnet that is in the field.
The strength of the magnetic force between two magnets depends on the strength of the magnets, the distance between the magnets, and the angle between the magnets. The magnetic force is strongest when the magnets are strong, close together, and aligned with each other.
Magnetic force is responsible for many things, including the way a compass works and the way metals are attracted to magnets. Magnetic force is also used in a variety of devices, such as motors, generators, and MRI machines.