An electromagnet is a coil whose field you can switch on, turn up, and multiply by dropping iron down the middle: B = μrμ0nI. Drag the sliders below to set the turns, coil length and current, then swap the core and watch both the field and the pull on the pole face respond.
Wind more turns into a shorter coil, push more current through it, then drop in an iron core and watch the field — and the pull on the pole face — jump by orders of magnitude.

The electromagnet simulator is a free interactive physics lab that runs in your browser — nothing to install and no sign-up. Change turns, coil length, current and core, and watch the field follow B = permeability x turns per metre x current. It reports field in the core and Holding force as you drag the sliders.
| Control | Range | Step |
|---|---|---|
| Number of turns on the coil | 10 – 1000 | 1 |
| Coil length | 0.02 – 0.40 m | 0.005 |
| Current through the coil | 0.1 – 5 A | 0.1 |
The three sliders all feed one number. Turns, N counts the wire wrapped round the core, Coil length, L sets how far that winding is spread out, and Current, I sets what flows through it. Watch the turns-per-metre figure as you move the first two: N and L never act on their own, only as the ratio n = N/L. Wind 500 turns over 0.25 m and you get 2,000 turns per metre; wind 1,000 turns over 0.50 m and the field readout does not move at all. Packing the same wire into a shorter coil is what raises the field — adding wire for its own sake is not.
The Core buttons are the only control here that shifts the answer by orders of magnitude. On air the lab uses a relative permeability of 1; on soft iron it uses 200. Every other input stays exactly where it was, and the field climbs from about 5 mT to just over 1 T. That one factor is the whole difference between a coil and an electromagnet: the current makes the field, but the iron multiplies it. Set the same turns per metre and current in the magnetic field calculator if you want to check the lab's arithmetic against a worked figure.
The second readout converts that field into pull. It applies F = B²A / 2μ0 across a fixed 1 cm² pole face, so the force follows the square of the field rather than the field itself. Halve B and the pull collapses to a quarter of what it was. That square is why the air-core setting cannot hold the 100 g test plate against the pole face at all, while the iron setting holds several kilograms with nothing else changed.
One last thing the bare formula will not tell you: choose soft iron and drag the current to the top. The SATURATED flag fires, the field stops dead at 2.0 T, and the force stops climbing with it. Written out, B = μrμ0nI promises a field that rises without limit; real iron simply runs out of domains to align and stops answering. For where that equation comes from and what saturation costs you in a real design, read Electromagnets: How They Work, or step back to the field itself in what a magnetic field actually is.
It is n = N/L: the number of turns of wire divided by the coil length in metres. The field depends on that ratio, not on the turns or the length separately. Winding 500 turns over 0.25 m and winding 1,000 turns over 0.50 m both give 2,000 turns per metre, and both produce exactly the same field for the same current.
This lab models soft iron with a relative permeability of 200, so the whole field equation is multiplied by 200 the moment you switch cores. Physically, iron is full of magnetic domains that line up with the coil's field and contribute their own, so the field inside the core ends up a couple of hundred times what the same current would produce in air. Real soft irons and steels range from roughly 100 to several thousand depending on the alloy and how hard you drive them.
Because the iron saturates. Once nearly every magnetic domain is already aligned there is nothing left for more current to recruit, so the field flattens out. The lab clamps the field at 2.0 T and raises a SATURATED flag when you reach it. An air core has no domains to run out of, so it never saturates — it is simply 200 times weaker the whole way up.
Not in the ideal long-solenoid formula this lab uses. The field depends only on the relative permeability, the turns per metre and the current, so widening the coil leaves the readout untouched. Diameter still matters in practice: it changes the length of wire you need, and therefore the resistance, the voltage and the heat. The formula also loses accuracy for short, fat coils, where the field near the ends falls well below the value at the centre.
From F = B squared times A, divided by twice the permeability of free space, with the pole-face area A fixed at 1.0 square centimetre. Because the field is squared, the pull is very sensitive to it: halving the field quarters the force. At the air-core default the force is about 0.001 N, which will not hold anything; switching to soft iron takes it to about 40 N, enough to hold roughly 4 kg.