Explore permanent magnets and electromagnets
A moving electric charge creates a magnetic field. In a coil (solenoid), each turn contributes to a net magnetic field inside, analogous to a bar magnet. The field strength is proportional to current and turns per unit length. Reversing current direction reverses field polarity. Permanent magnets have aligned electron spins that act like many tiny current loops.
Plus 148+ other Pro labs covering AP Physics, Biology, Chemistry, Earth Science, and Math — with unlimited simulation time, advanced parameters, and detailed analytics.
Already have an account?
Sign in →A refrigerator magnet sticks because every iron atom inside it has electrons whose spins are roughly aligned, all pointing the same way like a tiny crowd doing the wave. A junkyard electromagnet does the same job with no permanent magnetism at all — flip the switch and a moving current through a coil creates a field strong enough to lift a car; flip it off and the car drops. The two devices look different but produce field-line patterns that are nearly identical away from the source. This lab lets you swap between a bar magnet and a current-carrying coil, drag a compass through the surrounding space, and watch the field lines bend and crowd together near the poles. Increase the current, add more turns, or reverse the current direction and the field responds — exactly the way Maxwell's equations predict.
MisconceptionMagnets attract all metals — that is what 'magnetic' means.
CorrectOnly ferromagnetic metals (iron, nickel, cobalt, and a few alloys) are strongly attracted. Aluminum, copper, gold, and silver are not pulled toward a refrigerator magnet at all. Try it with a soda can next to a strong magnet — nothing happens.
MisconceptionAn electromagnet has to have an iron core to work.
CorrectAn air-core coil already produces a magnetic field on its own — that is exactly what the simulation shows. The iron core is a multiplier: it raises the field by hundreds or thousands of times because iron's magnetic permeability is much greater than air's. The physics is the same; the iron just amplifies it.
MisconceptionMagnetic field lines are real physical lines that exist in space, like fishing lines.
CorrectThey are a drawing tool. The lines show the direction a compass needle would point at each location and how dense the field is, but space itself is not striped. The field is continuous and exists everywhere; the lines are just how we visualize it.
MisconceptionIf you cut a bar magnet in half, you get one piece that's just north and one that's just south.
CorrectYou get two complete magnets, each with its own north and south. Magnetism comes from aligned electron spins, and every chunk of the magnet still has those spins. There is no such thing as an isolated magnetic pole, no matter how small you slice.
Every moving charge generates a magnetic field — that is one of the four core results of electromagnetism, formalized by the Biot–Savart and Ampère laws. A single straight wire wraps a circular field around itself by the right-hand rule. Bend that wire into a loop and the field on the axis points straight through. Stack many loops into a solenoid and the contributions add up inside the coil while partially cancelling outside, giving you a field that looks just like a bar magnet's.
Magnetism in materials comes from the magnetic moments of their electrons. In ferromagnetic materials like iron, nickel, and cobalt, neighboring atoms naturally align their spins in domains, and an external field can line the domains up so the bulk material becomes magnetic. Aluminum and copper have electron configurations where these alignments do not lock in, so they show only very weak (paramagnetic or diamagnetic) effects that you can't feel with everyday magnets.
Inside a long solenoid, every turn contributes a field pointing in the same axial direction, so the contributions stack and the field is approximately uniform with magnitude B = μ₀(N/L)I. Outside, the field from each turn partially cancels its neighbors and what is left spreads through a much larger volume, so the field there is weak. That is why magnetic shielding and inductor cores funnel field through the inside.
NGSS HS-PS2-5 asks students to plan and conduct investigations to provide evidence that an electric current can produce a magnetic field — that is the core finding of this simulation. AP Physics 2 standard CHA-4.A and its companions CHA-4.B and CHA-4.C require students to model magnetic fields from permanent magnets and current-carrying configurations, and to predict directions using right-hand rules. The lab supports all of that by letting students vary current, turns, and bar strength while inspecting field lines and compass directions.
N/L is the number of turns per unit length, often written as n. Doubling the number of turns while keeping the coil the same length doubles the field, and stretching the coil to twice its length while keeping N constant cuts the field in half. Strong electromagnets are made by packing many tightly wound turns into a small length, then increasing the current. Adding an iron core multiplies the field on top of that.