On this page
You can't see a magnetic field, and a textbook diagram never moves. A simulation lets you change the current, move a probe and watch the field lines respond. This guide covers three shapes that come up again and again in CBSE Class 12 and JEE physics: a straight wire, a loop and a solenoid. For each one you get the rule for direction, the formula for strength and a prediction to test.
Which way does the magnetic field around a wire point?
Around a long straight wire the field lines are closed circles centred on the wire. OpenStax University Physics states the right-hand rule: "If you hold the wire with your right hand so that your thumb points along the current, then your fingers wrap around the wire in the same sense as B."
For a loop, swap the roles of thumb and fingers. Curl your right-hand fingers the way the current flows round the loop, and your thumb points along the field through the centre. A solenoid is many loops stacked together, so the same curl rule gives the field direction inside it. The end your thumb points out of acts like a north pole.
If you confuse these rules with the one for the force on a moving charge, see our explainer on the right-hand rule for magnetic force.
How does field strength change with distance and current?
Straight wire: the field of a long straight wire is B = μ0I/2πr, where r is the distance from the wire (OpenStax 12.2, which uses μ0 = 4π × 10⁻⁷ T·m/A).
Centre of a loop: the field at the centre of a circular loop of radius R is B = μ0I/2R, or μ0NI/2R for N turns (OpenStax 12.4).
Inside a long solenoid: the field is B = μ0nI, where n is turns per metre (OpenStax 12.6). Near the centre it is "quite uniform and directly proportional to the current", and for an ideal solenoid the field outside is zero.
In all three, B is proportional to the current. Only the geometry differs: 1/r for the wire, 1/R at the loop's centre, and turn density alone for the solenoid. Our Biot–Savart and Ampère's law guide shows where each formula comes from.
Worked example: can a wire move a compass?
Try this calculation before you open a simulation. Take a wire carrying 1 A, with a compass 1 cm away, and use B = μ0I/2πr from OpenStax.
B = (4π × 10⁻⁷ × 1) / (2π × 0.01) = 2 × 10⁻⁵ T, or 20 microtesla.
Earth's magnetic field at the surface is roughly 25,000 to 65,000 nanotesla (25 to 65 microtesla), according to NOAA's National Centers for Environmental Information.
The two fields are about the same size, so the compass should swing noticeably but settle somewhere between north and the wire's field direction.
Compare that with a solenoid. OpenStax's Example 12.9 takes 300 turns over 14.0 cm carrying 0.410 A and gets about 1.10 × 10⁻³ T inside, about 55 times the wire's field, even though the wire carries more current. Closely wound turns are what make an electromagnet useful.
What predictions can you test in a simulation?
Write each prediction down before you touch a slider. Being wrong on paper and then seeing why gives you something concrete to fix. Each prediction below follows from the OpenStax formulas above.
Double the current in the wire. The field at a fixed point doubles. The lines crowd together but stay circular.
Move the probe from 2 cm to 4 cm. B halves. If it drops to a quarter, recheck your distances.
Reverse the current in a loop. The field through the centre flips, so the north and south faces swap.
Slide the probe across the inside of a long solenoid. The reading barely changes away from the ends, then falls sharply outside.
Stretch the solenoid to twice its length, same turns. n halves, so the field inside halves at the same current.
To run these, the Fermi Simulation Lab has interactive simulations for ideas that are easier to see than to read. When a result surprises you, Fermi's AI tutor notices where you are stuck and decides whether to explain, ask or show.
How is this different from an electric field?
Electric field lines start on positive charges and end on negative ones, but magnetic field lines always close on themselves, as the wire's circles show. Comparing the two pictures is a useful check, and our guide to reading electric and magnetic field lines uses the same predict-then-check method.
Pick one prediction above, write it down and test it today.



