How Do Magnets Work? The Physics Behind Magnetism

A magnet can pull a paper clip across a table without touching it, make a compass point north, and generate electricity when moved through a coil of wire. These effects can seem almost mysterious because magnetic forces act at a distance.

The underlying physics is less mysterious but surprisingly deep. Magnetism comes from moving electric charge, from an intrinsic quantum property of particles called spin, and from the way many atomic magnetic moments can become organized. Electric and magnetic fields are also two aspects of the same electromagnetic field, which is why electricity and magnetism are so closely connected.

Understanding magnets starts at the atomic scale, but the same principles explain everything from a refrigerator magnet to an electric motor.

What is a magnet?

A magnet is an object that produces a magnetic field and can exert magnetic forces on other magnetic materials, electric currents, or moving charges.

Every magnet has two magnetic poles, conventionally called north and south. Opposite poles attract, while like poles repel. If you break a bar magnet in half, however, you do not isolate a north pole from a south pole. Each piece becomes a smaller magnet with its own north and south poles.

This behavior is fundamentally different from ordinary electric charge. Electric charges can exist individually as positive or negative charges. Magnetic poles, as they occur in ordinary magnets, always appear together.

Physicists describe a magnet’s influence using its magnetic field, usually represented by the symbol B. The field is not a material substance flowing through space. It is a physical field that determines how magnetic forces and other electromagnetic effects behave at different locations.

Where magnetism comes from

At the most fundamental level, magnetism is associated with electric charge in motion.

An electric current—a flow of charged particles—produces a magnetic field. This is why a wire carrying current can affect a nearby compass. Wrap the wire into a coil, and the magnetic fields produced by the individual sections of wire combine into a stronger, organized field. An electromagnet uses this principle.

But permanent magnets raise a deeper question: what produces magnetism inside a piece of solid material when no current is visibly flowing through it?

The answer lies in atoms.

Atoms contain electrons, and electrons have electric charge. Their quantum behavior gives them magnetic moments, which means they behave in some respects like tiny sources of magnetism.

Two contributions are especially important. Electrons have orbital motion associated with their quantum state, which contributes to magnetism. More importantly for many permanent magnets, electrons possess an intrinsic quantum property called spin. Despite the name, spin should not be imagined as a tiny ball literally rotating like a planet. It is an intrinsic property of elementary particles with no exact classical equivalent.

An electron’s spin gives it an intrinsic magnetic moment.

Why most objects are not magnets

If electrons have magnetic moments, why isn’t everything magnetic in an obvious way?

Because those magnetic moments generally do not line up.

In many atoms, electrons occur in pairs with opposite spin orientations. Their magnetic moments largely cancel. Even when individual atoms have a net magnetic moment, the moments in a material may point in different directions, so their effects cancel on a larger scale.

A permanent magnet requires a much greater degree of organization.

In certain materials, interactions between neighboring atomic magnetic moments favor particular alignments. The material can divide into regions called magnetic domains, within which many atomic magnetic moments are aligned in a coordinated way.

When the domains point in random directions, their fields largely cancel and the material may not behave like a strong magnet.

When many domains become aligned, their magnetic fields reinforce one another. The material then has a substantial net magnetic field.

This is the basic physical picture behind permanent magnetism.

What are magnetic domains?

A magnetic domain is a region within a magnetic material in which atomic magnetic moments are arranged in a relatively coordinated orientation.

A piece of ferromagnetic material can contain many such domains. Their boundaries and orientations depend on the material’s microscopic structure and its magnetic history.

When an external magnetic field is applied, domains that are favorably oriented can grow while others shrink or rotate. If enough alignment remains after the external field is removed, the material becomes permanently magnetized.

This is why magnetizing a material is not simply a matter of “adding magnetism.” It changes the organization of microscopic magnetic moments.

In a hard permanent magnet, the material’s structure makes that organization relatively resistant to being undone. In a soft magnetic material, the domains can rearrange readily, making the material easier to magnetize and demagnetize.

Why some materials are strongly magnetic

The strongest everyday magnetic materials are generally ferromagnetic materials, including iron and certain alloys and compounds.

Ferromagnetism arises from quantum mechanical interactions between electrons. A key effect is the exchange interaction, which is ultimately connected to the quantum-mechanical indistinguishability of electrons and the Pauli exclusion principle. Under suitable conditions, this interaction makes certain parallel arrangements of electron spins energetically favorable.

This is an important point because the popular picture of magnets as collections of tiny current loops is useful but incomplete. The strongest permanent magnetism in materials cannot be fully explained using classical physics alone. Quantum mechanics is essential.

Not all materials respond to magnetic fields in the same way. Paramagnetic materials are weakly attracted to magnetic fields because some atomic magnetic moments tend to align with the applied field, but thermal motion works against persistent alignment. Diamagnetic materials develop a weak magnetic response that opposes an applied magnetic field.

These effects occur to some degree in essentially all materials, but ferromagnetism can produce a dramatically stronger macroscopic effect.

How does a magnet attract a paper clip?

A paper clip is typically made primarily of steel or another ferromagnetic material. Before it encounters a strong magnet, its microscopic magnetic domains are not necessarily arranged to produce a large external magnetic field.

Bring the paper clip near a magnet, and the magnet’s field influences the magnetic moments within the material. Domains favorably oriented with the external field can become more prominent, producing a net magnetization in the paper clip.

The paper clip therefore becomes temporarily magnetized.

The side of the paper clip closest to the magnet develops a magnetic orientation that results in attraction. The magnet does not need to permanently magnetize the paper clip for this to happen.

This is also why a magnet can attract an unmagnetized piece of iron. The object does not need to be a permanent magnet beforehand.

Why magnets have fields

A magnetic field gives us a way to describe magnetic effects throughout space.

You can visualize a magnetic field using field lines. Outside a bar magnet, these are conventionally drawn as lines emerging from the north pole and entering the south pole. The lines are a visualization tool, not physical strings extending through space.

Where field lines are drawn more densely, the magnetic field is stronger. The direction of the field at a point is defined by the direction a north magnetic pole would tend to move if placed there.

Magnetic fields can also be produced by electric currents and by moving charged particles. A magnetic field can exert a force on a moving charge according to the Lorentz force. In vector form, the magnetic part of that force isF=q v×B\mathbf{F}=q\,\mathbf{v}\times\mathbf{B}

where qq is the particle’s electric charge, v\mathbf{v} is its velocity, and B\mathbf{B} is the magnetic field.

The cross product means the magnetic force is perpendicular to both the particle’s motion and the magnetic field. This is why magnetic fields can bend the paths of charged particles without necessarily increasing their speed.

Why a compass points north

A compass needle is a small permanent magnet that can rotate freely.

Earth itself produces a magnetic field, largely because of electric currents associated with the motion of electrically conducting liquid metal in its outer core. This process is called the geodynamo.

The compass needle experiences a torque—the rotational effect of a force—that tends to align its magnetic moment with Earth’s magnetic field.

The end conventionally called the north-seeking pole of the compass points approximately toward geographic north because of the orientation of Earth’s magnetic field in that region.

The distinction between geographic and magnetic north matters. Earth’s magnetic field is not perfectly aligned with its rotation axis, and the field changes over time. A compass therefore does not simply point toward a fixed physical “magnetic north pole” in a universal sense.

Why magnetic field lines never simply end at one pole

A familiar diagram shows field lines leaving the north pole of a bar magnet and entering its south pole. Inside the magnet, however, the field lines continue from south toward north, forming closed loops in this representation.

This reflects an important property of ordinary magnetism: magnetic field lines have no known beginning or end in the way electric field lines can begin on positive charges and end on negative charges.

Mathematically, this is expressed by Gauss’s law for magnetism:∇⋅B=0\nabla\cdot\mathbf{B}=0

In classical electromagnetism, this means there are no isolated magnetic charges—often called magnetic monopoles—in the ordinary magnetic phenomena we observe.

The absence of observed magnetic monopoles is also why breaking a bar magnet does not produce a standalone north pole.

How electromagnets work

An electromagnet converts electrical energy into a controllable magnetic field.

When current flows through a wire, it produces a magnetic field around the wire. Coiling the wire concentrates the effect so that the field runs through the center of the coil and around its exterior.

Adding a ferromagnetic core, such as iron, can make the magnetic field much stronger because the material becomes magnetized and responds strongly to the applied field.

The major advantage of an electromagnet is control. Its magnetic strength can generally be changed by changing the current, and reversing the current reverses the magnetic field’s direction.

This principle is used in devices such as relays, speakers, motors, magnetic locks, and lifting equipment.

How magnets generate electricity

The relationship works in the opposite direction too: changing magnetic fields can produce electric fields.

This is electromagnetic induction, described by Faraday’s law. If the magnetic flux through a conducting loop changes, an electromotive force is induced around the loop.

In simplified form,E=−dΦBdt\mathcal{E}=-\frac{d\Phi_B}{dt}

where E\mathcal{E} is the induced electromotive force and ΦB\Phi_B is the magnetic flux through the circuit.

The minus sign expresses Lenz’s law: the induced effect opposes the change in magnetic flux that produced it.

This is the fundamental principle behind electrical generators. A generator does not create energy from magnetism. Mechanical energy is used to move magnets, coils, or both, and electromagnetic induction converts that mechanical energy into electrical energy.

How electric motors use magnetism

An electric motor reverses the basic generator idea.

Instead of using motion to induce electrical effects, a motor uses electric currents interacting with magnetic fields to produce forces and torque.

A current-carrying wire placed in a magnetic field experiences a force. Arrange coils and magnetic fields appropriately, and those forces produce continuous rotation.

In a motor, electrical energy becomes mechanical energy. In a generator, mechanical energy becomes electrical energy.

The same electromagnetic laws govern both processes.

What makes a magnet lose its magnetism?

A permanent magnet’s magnetization depends on the stability of its microscopic magnetic structure.

Heating a magnet can disrupt the ordered arrangement of magnetic moments. Every ferromagnetic material has a characteristic Curie temperature, above which it loses its long-range ferromagnetic order and becomes paramagnetic.

Strong opposing magnetic fields can also rearrange magnetic domains and reduce magnetization. Mechanical shocks may contribute in some materials by disturbing domain structures, although the effect depends strongly on the magnet’s composition and construction.

Cooling a material does not universally make it more strongly magnetic. Magnetic behavior depends on the material’s quantum interactions and phase, so temperature can affect different materials in different ways.

Why magnets can push as well as pull

Magnets are commonly introduced through attraction, but magnetic forces can also produce repulsion.

Two bar magnets with like poles facing each other tend to rotate and move apart. Opposite poles tend to rotate into an attractive configuration.

At the microscopic level, the interaction is more naturally described through magnetic fields and magnetic moments than through the idea that “north poles attract south poles” as independent objects.

A magnetic dipole—a system with a north-like and south-like orientation—placed in a nonuniform magnetic field can experience both a torque and a net force. The torque tends to align the dipole with the field, while differences in field strength across the object can produce a net attraction or repulsion.

Magnetism is part of electromagnetism

Electricity and magnetism were once studied as separate phenomena. Modern physics shows that they are deeply connected.

Moving electric charges produce magnetic fields. Changing magnetic fields produce electric fields. Electric and magnetic fields can propagate through space together as electromagnetic waves.

Visible light is one kind of electromagnetic wave. So are radio waves, microwaves, infrared radiation, ultraviolet radiation, X-rays, and gamma rays. They differ primarily in frequency and wavelength.

This unification is captured by Maxwell’s equations, which describe how electric and magnetic fields are generated and how they interact.

There is an even deeper connection: whether a phenomenon looks primarily electric or magnetic can depend on the observer’s state of motion. Special relativity shows that electric and magnetic fields are different aspects of a unified electromagnetic field.

The quantum foundation of ordinary magnets

At the deepest level, permanent magnetism cannot be explained by classical electromagnetism alone.

The magnetic moments of electrons arise from quantum mechanics. Electron spin, orbital angular momentum, and interactions among electrons determine how magnetic moments behave inside matter.

Quantum mechanics also explains why certain materials develop strong, organized magnetism while others do not. The exchange interaction, electron configurations, crystal structure, and thermal effects all contribute.

So the simple bar magnet sitting on a refrigerator represents several layers of physics at once: quantum behavior inside atoms, collective organization within a solid, classical electromagnetic fields, and forces acting on other matter.

That combination is what makes magnetism both familiar and fundamental. A magnet is not powered by an invisible reservoir of energy, nor does it violate the laws of physics by exerting force without contact. Its behavior follows from the electromagnetic properties of charged particles and the quantum rules governing matter.

Looking For Something Else?